Prevent Clear Cache on product pur

[ad_1]

Hello @andrijam

Thank you for reaching out.
Well, this is indeed a specific request. In most cases once the product is ordered the cache should be renewed. This being said, try disabling the options in Performance>Page Cache>Purge policy. If the cache is being purged after these settings are disabled, there is a chance that your theme or other plugin you are using may be calling w3tc_flush_all();

You can check what may be calling the purge in the Performance>General settings>Debug section by enabling the Page Cache Purge log.

I hope this helps!

Thanks for the reply, I found the causes. I’ll add this code and see if it fixes it:

add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_false’);

causes1:

#4 wp-content/plugins/seo-by-rank-math/includes/class-helper.php(239)w3tc_pgcache_flush ()

#5wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache.php(245)RankMath\Helper–clear_cache (“sitemap/1”)

#6wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache-watcher.php(322)RankMath\Sitemap\Cache–invalidate_storage (“1”)

causes2:

I am not sure for this, no post was update and no comment was placed, but something flush cache:

#3wp-includes/class-wp-hook.php(308)W3TC\Util_AttachToActions–on_post_change (15233, {“ID”:15233,”post_author”:”0″,”post_date”:”2022-12-29 16:01:49″,”post_date_gmt”:”2022-12-29 15:01:..)

#4wp-includes/post.php(7404)do_action (“clean_post_cache”, 15233, {“ID”:15233,”post_author”:”0″,”post_date”:”2022-12-29 16:01:49″,”post_date_gmt”:”2022-12-29 15:01:..)

#5wp-includes/comment.php(2755)clean_post_cache ({“ID”:15233,”post_author”:”0″,”post_date”:”2022-12-29 16:01:49″,”post_date_gmt”:”2022-12-29 15:01:..)

Hello @andrijam

Thank you for your feedback. It’s a known fact that Rank math is calling the w3tc flush. We are working on the solution or a code snippet that will prevent this if the user need this for the usecase.

Can you please confirm that the Purge policy options are disabled?
Thanks!

After a few hours I can confirm that the problem is solved.

add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_false’);

Shop is now blazing fast, I also recommend bash cache regenerate on Ubuntu in Scheduled Cron Jobs.

andrijamicic/bash-cache-warmer: This is a bash script that uses curl to warm up cache by targeting the sitemap.xml of the website (github.com)

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer