Hello,
Are you using any cache plugin? If yes, which one? You might need to add the following exceptions for the cache:
/(.*)sitemap(.*).xml
/(.*)sitemap.xsl
Looking forward to help you.
Hi Alberto,
We’re using Varnish and Redis caching. It’s impossible to enter the exceptions as you mention.
Greetings from Bas
Hello,
I am not sure but you might need to ask your hosting support about it, I found some ways to add exceptions on Varnish so they might can help you (https://www.section.io/docs/modules/varnish-cache/how-tos/exclude-url-from-cache/).
Looking forward to help you.
Hi Alberto,
But when I switch off varnish cache, still the sitemap isn’t updated.
Greeetings from Bas
Hello Bas,
Once you have switched off the caching please head to your WordPress dashboard > Rank math > Sitemap Settings and change the links per sitemap to a different value such as 501 or 201 or any other value different from the existing one. Once done, please save your settings and test check your sitemap in a private/incognito browser.
Looking forward to helping you. Thank you.
Hello,
I wanted to add that you can disable the Sitemap cache that is created by Rank Math as well by using this filter:
https://rankmath.com/kb/filters-hooks-api-developer/#enable-disable-sitemap-cache
Let us know how it goes.
Hi Uzair,
I’m not a developer. I used DIVI. Where do I need to add the code?
Greetings from Bas
Hi Michael,
where in the user interface can I change the value?
greetings from Bas
Hello,
You just need to go to the WordPress Dashboard > Appearance > Theme Editor and there look for the file called functions.php.
Inside that file, go at the end and paste the code my colleague shared. After that save the file and resave the permalinks.
Looking forward to help you.
Hello,
How long Rank Math cache the sitemap? I checked and my sitemap is 3 days outdate.
Disabling the cache will cause performance issues. It should be purge every post update …
Hi Alberto,
What do you mean with “After that save the file and resave the permalinks.”. Do I need to do that manually?
Greetings from Bas
Hello,
@APKMODY Rank math sitemap cache is flushed every time a post is updated or published. You should check if you have any other caching setups in place.
@Bas To resave your permalinks, Head over to WordPress Dashboard > Settings > Permalinks. Hit the save button once. You can then check if your sitemap is loading fine in a private/incognito browser by going to https://yoursiteURL/sitemap_index.xml
Let us know if this fixes your issue.
Looking forward to helping you. Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.