Forums › Forums › Search & Filter Pro › Rebuild cache on cron
Tagged: cache, update cache
- This topic has 7 replies, 2 voices, and was last updated 5 years, 5 months ago by Trevor.
-
Anonymous(Private) August 21, 2019 at 10:19 am #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 aforeach
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.
Anonymous(Private) August 28, 2019 at 3:15 pm #219863Hello 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 theget_queried_object()
loop.Do you have any ideas what we are missing please?
Kind regards,
Dean
Trevor(Private) August 29, 2019 at 9:27 am #219938And 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.
-
AuthorPosts