How to disable automatic purging of entire cache
-
Hello,
I noticed that entire cache is purged automatically every time anything is changed/saved on the site. For example, updating existing posts/pages and WooCommerce products, saving settings on any plugin, deactivating plugins, etc. How can I disable this?
-
Hi,
Can you add the following code to your active theme’s functions.php file
add_filter('wpo_purge_all_cache_on_update', '__return_false');
Hi,
Thanks for sharing this filter. Unfortunately, this filter does not seem to work. When one WooCommerce product is updated the entire site cache is purged which does not make any sense.
Is there anything else we can try to stop automatic purging of entire cache?add_action('save_post', array($this, 'purge_post_on_update'), 10, 1); add_action('save_post', array($this, 'purge_archive_pages_on_post_update'), 10, 1); add_action('wp_trash_post', array($this, 'purge_post_on_update'), 10, 1); add_action('comment_post', array($this, 'purge_post_on_comment'), 10, 3); add_action('wp_set_comment_status', array($this, 'purge_post_on_comment_status_change'), 10, 1); add_action('edit_terms', array($this, 'purge_related_elements_on_term_updated'), 10, 2); add_action('set_object_terms', array($this, 'purge_related_elements_on_post_terms_change'), 10, 6); add_action('wpo_cache_config_updated', array($this, 'cache_config_updated'), 10, 1); add_action('wp_insert_comment', array($this, 'comment_inserted'), 10, 2); add_action('import_start', array($this, 'remove_wp_insert_comment')); add_action('update_option_page_on_front', array($this, 'purge_cache_on_homepage_change')); add_action('update_option_page_for_posts', array($this, 'purge_cache_on_blog_page_change'), 10, 2); add_action('woocommerce_variation_set_stock', array($this, 'purge_product_page'), 10, 1); add_action('woocommerce_product_set_stock', array($this, 'purge_product_page'), 10, 1);
The above is the plugins code, you could add any of these as a filter
Ok. So I’ve tried them all, but none of them worked. Every time the post / page or WooCommerce product is updated, the entire cache is purged which is unacceptable.
FYI, adding this filter add_filter(‘cache_config_updated’); caused critical error on the site.
Is there anything else we can do here to make caching functionality usable in this plugin?- This reply was modified 10 months, 3 weeks ago by ibro87.
Hi,
It doesn’t purge everything, just the related items terms, categories etc.
Do you have minify enabled, can you try disabling it?
Hi,
I do NOT want anything to be purged automatically. I have thousands of products on the website. Updating one single product purge them all including all other content on the website which makes caching pointless. Is there a fix for this?
FYI, no minification is enabled in the plugin settings.Did you try adding all filters for all of the above at the same time or did you try one at a time?
Hi,
I tried adding one by one filter. Should I add them all at once?Yes, you would need to add them all to stop all automatic purging.
For example the first one purge_post_on_update, if you set it to false it would just stop a post’s cache being purged when a post is updated and not in any other circumstance.
There are some woocommerce ones there that you are likely going to want to leave as, as an example, you would want your product quantities to be updated when you have made a sale.
Hi vupdraft,
Thank you for your explanation. I totally get that every filter has its own functionality. So, I’ve added them all as suggested (see here please) but none of these filters seem to prevent automatic purging on the website.
For example, when new WooCommerce product is added or updated on the website, entire purge automatically occurs for all the content on the website right after clicking on “Publish” / “Update” button.
Am I missing something here?I am just checking this with my colleague to see if they can suggest anything further.
Hi vupdraft ,
Sounds good. Thank you!Can you try adding the following: add_filter(‘wpo_purge_cache_hooks’, ‘__return_empty_array’);
Hi vupdraft,
Thanks for your effort and willingness to help. Unfortunately, this filter does not work either. Is there anything else we can try to make this work?
- The topic ‘How to disable automatic purging of entire cache’ is closed to new replies.