Sometimes, even after publishing a blog post, the WordPress sitemap might not get updated. This issue could stem from caching. Start by clearing both your browser cache and server cache, then check if the problem persists. Additionally, setting cache exceptions for certain files, including the sitemap and robots.txt, could prove beneficial.
If you're using Rank Math SEO, a temporary workaround is to adjust the number of items in your sitemap, which will prompt the latest posts to appear in the sitemap.
Fixing Sitemap Update Issues in Rank Math SEO
When utilizing an SEO plugin like Yoast SEO or Rank Math SEO on your WordPress site, the sitemap URL typically is example.com/sitemap_index.xml.
By accessing this sitemap address via browsers like Chrome, you should see the latest posts reflected. However, there may be rare instances where recent posts do not appear. If Rank Math is managing your sitemap, modifying the item count for individual sitemaps can trigger updates to include new posts.
Navigate to WordPress Dashboard » Rank Math SEO » Sitemap Settings » General to adjust the Links per Sitemap settings. The default number is set at 200, so changing this to 201 or another value will refresh the sitemap.
Setting Cache Exclusions for Sitemap
It’s advisable to configure caching settings to exclude the sitemap, robots.txt, ads.txt, feed URLs, and similar files. Notably, if you are hosting with Cloudways, caching could prevent Google from recognizing the ads.txt file, which might trigger a 'revenue loss risk' warning in your AdSense account.
If your site is hosted on Cloudways, check the Breeze caching plugin and the application settings on Cloudways’ dashboard to exclude the following items from caching:
- Sitemap URL
- ads.txt (if displaying AdSense ads)
- robots.txt
- Feed URLs
You can enter the URLs to exclude from caching in the Breeze plugin under Advanced Options » Never Cache URL(s).
When using the sitemap features of Yoast SEO and Rank Math SEO, the sitemap URL is /sitemap_index.xml. For the All-in-One SEO plugin, the sitemap URL is /sitemap.xml.
(As a note, only one SEO plugin should be installed and used. Sometimes, people install and use both Yoast SEO and Rank Math together. In such cases, warnings may occur, and it can negatively impact SEO. The same applies to cache plugins. If two or more cache plugins are installed and used together, it can actually slow down the site and cause strange issues.)
Additionally, within Cloudways' Applications list, select your application and go to Application Settings » Varnish Settings to add URLs that should be excluded from caching.
If you’re utilizing the WP Rocket plugin, you can configure cache exclusion settings directly within WP Rocket's options. For detailed instructions, refer to the specific guide addressing ads.txt files; similar methods can be used for sitemap URLs.
When using the LiteSpeed Cache plugin, you can exclude URLs from caching by entering them in the Do Not Cache URIs textbox under the Excludes tab.
If the above measures do not resolve the issues, deactivate all plugins except for Rank Math SEO and check if the sitemap updates to include the latest posts.
Should the problem persist despite all efforts, consider reaching out to your web hosting provider for assistance with the issue.