Forums › Forums › Search & Filter Pro › Cronjob for rebuilding cache
Tagged: cache cronjob acf acf_form
- This topic has 8 replies, 3 voices, and was last updated 10 years, 8 months ago by
Ross.
-
Anonymous(Private) October 8, 2015 at 10:45 am #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(Private) October 8, 2015 at 10:47 am #26826Oeps, 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(Private) October 8, 2015 at 10:53 am #26827Hey 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
Ross Moderator(Private) November 5, 2015 at 5:39 pm #29005Hey John
I’ve just added an action for this:
do_action('search_filter_update_post_cache', 1984);Change
1984for your post ID.This is not yet released yet but I’ve emailed you this update directly.
Thanks
Anonymous(Private) March 3, 2016 at 9:09 pm #38644Just 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(Private) March 3, 2016 at 9:51 pm #38661Hey 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(Private) March 4, 2016 at 2:55 pm #38707Okay, 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(Private) March 7, 2016 at 10:23 am #38808Hey 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_IDand also without the colon afterThanks
-
AuthorPosts