I enjoy using Rank Math to handle my site's essential SEO settings.

A couple of weeks ago though I discovered an issue with my sitemaps: they weren't updating.

I noticed that my posts were getting crawled by Google (I often manually submit them to the Search Console after publishing a post), but it was telling me they weren't included in any of my sitemaps.

I took a look at my /post-sitemap.xml file and sure enough it didn't have any of my recent posts.

The first thing I thought is that it must've been getting cached through Cloudflare or on my server, but I checked the page headers and this wasn't the case.

I flushed all my caches, and also used https://test.ismypagecached.com/ to make sure.

I reached out to Rank Math's support and they directed me to How to Exclude Rank Math Sitemaps from Caching, but obviously that wasn't going to help if they weren't being cached.

They did however provide another snippet that fixed the issue:

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

You can add that using the Code Snippets plugin or to your theme's functions.php file.

I'm still not sure exactly if a Rank Math or a server configuration issue was the cause, but if you find that your sitemaps aren't updating and they're not being cached, that should fix things for you.

Hope that helps!