🛍 [BLACK FRIDAY] DISCOUNT! + 2x Benefits + $15k Worth of Offers for FREE

LEARN MORE!

How to Prevent Rank Math from Flushing W3 Total Cache

In this knowledgebase article, we’ll show you how to prevent Rank Math from flushing W3 Total Cache.

Preventing Rank Math from Flushing W3 Total Cache

In Rank Math, we use the w3tc_pgcache_flush function to flush the cache when a post is updated or added to the site. If you don’t want Rank Math to flush the cache, then follow the steps we’ve discussed below.

1 Navigate to the Theme File Editor

First, navigate to Appearance → Theme File Editor (for a Classic Theme) inside your WordPress admin area.

navigate to the Theme File editor

2 Add Code Snippet

Please disable the Sitemap cache by adding the following filter code to your theme’s rank-math.php file to prevent the plugin from running this function. You can further refer to our dedicated tutorial on how to add a filter/hook to your website.

add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

Navigate to the rank-math.php file and add the code snippet, as shown below.

Add caching code

3 Update the File

Once you’ve added the code snippet, click on the Update File button to save the changes made to the file.

Update the File

If you still have questions – you’re always more than welcome to contact our dedicated support team. We’re available 24/7, 365 days a year…

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles