W3 Total Cache, upon edit post Rank Math purge all the caches

#189634
  • Hello,
    I’m using Rank Math and W3TC with standard page cache.
    When I edit a post W3TC purge the cached version of the edited post (expected behavior), but after this Rank Math force a complete purge of all the caches.

    How do I prevent RankMath to interfere with the page cache?

    Atteched the stack traces:

    Thnaks!

    Date Tue, 27 Apr 2021 17:36:54 +0000
    Action flush_post(20283)
    Stack Trace
    #0	wp-includes/class-wp-hook.php(289)	W3TCPgCache_Plugin--w3tc_flush_post (20283)
    #1	wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(156)	do_action ("w3tc_flush_post", 20283, null)
    #2	wp-content/plugins/w3-total-cache/Util_AttachToActions.php(93)	W3TCCacheFlush--flush_post (20283)
    #3	wp-includes/class-wp-hook.php(289)	W3TCUtil_AttachToActions--on_post_change (20283)
    #4	wp-includes/post.php(3986)	do_action ("pre_post_update", 20283, {"post_author":1,"post_date":"2020-03-19 11:40:00","post_date_gmt":"2020-03-19 10:40:00","post_con..)
    #5	wp-includes/post.php(4354)	wp_insert_post ({"post_author":1,"post_content":".!-- wp:image {\"id\":20284,\"sizeSlug\":\"large\"} -.., false)
    #6	wp-admin/includes/post.php(419)	wp_update_post ({"ID":20283,"post_author":1,"post_date":"2020-03-19 11:40:00","post_date_gmt":"2020-03-19 10:40:00..)
    #7	wp-admin/post.php(227)	edit_post ()
    Date Tue, 27 Apr 2021 17:36:56 +0000
    Action flush_all
    Stack Trace
    #0	wp-includes/class-wp-hook.php(287)	W3TCPgCache_Plugin--w3tc_flush_posts (null)
    #1	wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(166)	do_action ("w3tc_flush_posts", null)
    #2	wp-content/plugins/w3-total-cache/w3-total-cache-api.php(249)	W3TCCacheFlush--flush_posts (null)
    #3	wp-content/plugins/w3-total-cache/w3-total-cache-api.php(277)	w3tc_flush_posts ()
    #4	wp-content/plugins/seo-by-rank-math/includes/class-helper.php(234)	w3tc_pgcache_flush ()
    #5	wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache.php(220)	RankMathHelper--clear_cache ()
    #6	wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache-watcher.php(324)	RankMathSitemapCache--invalidate_storage ("1")
    #7	wp-includes/class-wp-hook.php(287)	RankMathSitemapCache_Watcher--clear_queued ("")
    #8	wp-includes/load.php(1007)	do_action ("shutdown")
    #9	()	shutdown_action_hook ()
Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    Thank you for bringing this to our attention and apologies for the inconvenience caused.

    To exclude Rank Math from Caching along with W3 total cache, please see the instruction provided on the support link below:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    To exclude Rank Math’s sitemap from being cached by W3 Total Cache, head over to Performance > Page Cache. There, enter the following code in the section, which says, “Never cache the following pages“.

    sitemap(_index)?\.xml(\.gz)?
    [a-z0-9_\-]*sitemap[a-z0-9_\-]*\.(xml|xsl|html)(\.gz)?
    ([a-z0-9_\-]*)?\.xml

    It is a simple regular expression that tells W3 Total Cache to exclude XML and XSL files with “sitemap” in the name.

    I hope that helps and please do not hesitate to contact us back anytime if you require further assistance.

    Cheers,

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,
    thanks for the prompt reply.
    I already followed the tutorial to exclude the sitemaps from being cached by w3tc, checked again but it does not solve the issue: the full page cache is clearead upon any post edit.

    It seems to me that the problem is caused by wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache-watcher.php that issues a page cache flush

    #1 	wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(166) 	do_action ("w3tc_flush_posts", null)
    #2 	wp-content/plugins/w3-total-cache/w3-total-cache-api.php(249) 	W3TC\CacheFlush--flush_posts (null)
    #3 	wp-content/plugins/w3-total-cache/w3-total-cache-api.php(277) 	w3tc_flush_posts ()
    #4 	wp-content/plugins/seo-by-rank-math/includes/class-helper.php(234) 	w3tc_pgcache_flush ()
    #5 	wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache.php(220) 	RankMath\Helper--clear_cache ()
    #6 	wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/class-cache-watcher.php(324) 	RankMath\Sitemap\Cache--invalidate_storage ("author")
    #7 	wp-includes/class-wp-hook.php(287) 	RankMath\Sitemap\Cache_Watcher--clear_queued ("")

    Hello,

    Thanks for getting back to us.

    Assuming you are using the latest version of all the plugins, themes, and WordPress (please update if not yet), it would seem like a conflict with one of the plugins or the theme you are using.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Thanks, but due to our internal policies, we can’t give access to external developers.
    We are investigating the cache hooks of the RankMath sitemap module, I will post here our findings
    Thanks

    Hi, we solved by disabling the xml sitemap generation by RankMath and using a 3rd party plugin for the xml sitemaps.

    Thanks again.

    Hello,

    Thank you for the update.

    It seems that this issue is already resolved by using a 3rd party sitemap plugin for your site. Could you please confirm?

    However, if you have any other concerns, you can contact us anytime by creating a new ticket to assist you further with anything else.

    Thank you.

    Hi,
    I can’t say that the issue is resolved, I would say that the issue is “prevented” by using another xml sitemap plugin.
    I’ll close this thread as solved.
    Thanks again for your support.

    Hello,

    Thank you for that confirmation.

    You’re very welcome and if you have any further questions in the future, know that we are always here to help.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The ticket ‘W3 Total Cache, upon edit post Rank Math purge all the caches’ is closed to new replies.