Cronjob for rebuilding cache

Forums › Forums › Search & Filter Pro › Cronjob for rebuilding cache

Viewing 9 posts – 1 through 9 (of 9 total)
  • Anonymous
    #26825

    Hi Ross,

    when I change the taxonomy of a post, the results filter only updates the new situation after I have rebuild the cache. Therefore I would like to schedule a cronjob so the cache will be rebuild every night. Do you know how I can do that? Do you have programmed a kind of hook?

    Anonymous
    #26826

    Oeps, I just saw that someone posted a similar question here https://support.searchandfilter.com/forums/topic/cache/

    Sorry Ross, happy to wait for the new version.

    Ross Moderator
    #26827

    Hey John

    Just to check, how are you changing the taxonomy of the post? Anything via the post edit screen should be picked up by S&F and the cache should be automatically rebuilt for that post.

    Thanks

    Anonymous
    #26990

    Hi Ross,

    I post edit the custom posts through the acf_form on the front-end. I confirm that it automatically rebuilds the cache when I post edit a post through the common wordpress backend form. Consider it as a feature request.

    thanks

    Ross Moderator
    #29005

    Hey John

    I’ve just added an action for this:

    do_action('search_filter_update_post_cache', 1984);

    Change 1984 for your post ID.

    This is not yet released yet but I’ve emailed you this update directly.

    Thanks

    Anonymous
    #38644

    Just in case anyone is searching this, I am using this at the bottom of a custom template with several modal forms used to edit one of many dozens of fields of the custom post type. Each form uses acf_form and saves the changes via ajax. The problem was that the cache was not rebuilding itself each time I updated the fields.

    I dropped this little gem at the bottom of the template just before the close of the loop like so:

    do_action('search_filter_update_post_cache', 'the_ID();');

    and viola… good to go no matter which post no matter which fields.

    Thanks for the update!

    Ross Moderator
    #38661

    Hey Jason

    Thanks for the update.

    I would just be very careful that you are not rebuilding the cache for a post every time that page is reloaded/refreshed (even if there was no update) – if it was a busy page it could be pretty resource heavy.

    Thanks

    Anonymous
    #38707

    Okay, I did some more testing with this and I broke it. It worked initially, but doesn’t any more. I’m not sure why yet, just wanted to give an update for anyone that may be rooting around here someday.

    I’ll let you know if I figure anything else out.

    Thanks!

    Ross Moderator
    #38808

    Hey Jason

    Randomly I just saw an error too –

    do_action('search_filter_update_post_cache', 'the_ID();');

    This is wrong!

    It should be

    do_action('search_filter_update_post_cache', get_the_ID());

    Notice I’m using get_the_ID and also without the colon after

    Thanks

Viewing 9 posts – 1 through 9 (of 9 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.