Support Forums

Support Forums Forums Search & Filter Pro Rebuild cache on cron

This topic is: not resolved

This topic contains 7 replies, has 2 voices, and was last updated by  Trevor 3 weeks, 1 day ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Dean Claydon
    #219418

    Hello,

    I am wondering if there is a way that we can rebuild the cache automatically on a cron job every evening.

    Currently, I am using do_action('search_filter_update_post_cache', $post->ID); in a foreach loop that updates at midnight every day. However, this does not appear to rebuild the cache and the posts are not displaying on the filter.

    Is there any advice you can give please?

    We are using 2.4.6 version of the plugin.

    Trevor Moderator
    #219425
    This reply has been marked as private.
    Dean Claydon
    #219863

    Hello Trevor,

    Thank you for your reply.

    We have been busy trying to resolve our issue, however we are not much further unfortunately.

    I have seen in the documentation that you can use do_action('search_filter_update_post_cache', $postId); to update the post cache.

    To check that this has worked in our function, we are using:

    if (did_action('search_filter_update_post_cache') === 1) {
                        echo 'it worked';
                    } else {
                        echo 'its broken';
                    }

    And everytime it prints out “It worked”

    However, unfortunately the post is not showing in our custom post type.

    I have tried the WP_Query loop that is in the documentation as well as the get_queried_object() loop.

    Do you have any ideas what we are missing please?

    Kind regards,

    Dean

    Trevor Moderator
    #219869

    Immediately after you import the post, if you know the Post ID, go look in our cache table to see if it is there?

    Dean Claydon
    #219899

    I have taken a look in the cache table and I can see it there, with the updated field values.

    We are not importing any post, in fact we are updating the post.

    I am a bit lost here now, and hope you can help please.

    Trevor Moderator
    #219901

    And are the new values stored there?

    Dean Claydon
    #219930
    This reply has been marked as private.
    Trevor Moderator
    #219938

    And yet, when you do a search, those fields are wrong? I ask because our filter uses that cache table. Something sounds very wrong. If it is correct in the cache table, it should show like that in the results. Only some form of server/WordPress page caching (unrelated to our plugin) would stop this from being the case.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.