How do I prevent sitemaps from being cached?
Most cache plugins will, by default, be set up to not cache sitemap files. In the rare case your plugin or server is caching the sitemap, please add an exclusion for the sitemap files to your cache plugin. The steps vary by cache plugin, so please select your cache plugin below.
When finished, be sure to clear your caching from your plugin, theme, server, browser, or CDN such as Cloudflare. If you are not sure how to clear your server caching, please speak with your host provider. If you need to clear your browser caching, this guide on how to clear your browser’s cache may help.
Table of contents
W3 Total Cache
By default, W3 Total Cache is setup to not cache the Yoast sitemaps. Enabling some W3 Total Cache features may cause the sitemaps to be cached.
404 errors for static objects
If you’re using the setting ‘Do not process 404 errors for static objects with WordPress’, please add the following to the ‘404 error exception list’ under Performance > Browser Cache > General (section).
If you’re using W3 Total Cache to minify your pages, please add the following to the “Never minify the following pages:” setting under Performance > Minify > Advanced (section).
WP Super Cache
Go to Settings > WP Super Cache and click on the Advanced tab. Scroll down to the section where it says “Add here strings (not a filename) that forces a page not to be cached” and add the following:
WP Rocket offers sitemap preloading. Learn more here.
To prevent WP Rocket from caching the sitemaps, go to Settings > WP Rocket > Advanced Rules > Never Cache URL(s) and exclude the following:
Other cache plugin or method
If you are using a different plugin or caching is done at the server level then contact the plugin developer or your hosting company for support.