Hello,
We apologize for the issue you are facing. Currently, there isn’t a built-in feature in Rank Math to automate the sitemap rebuild through a cron job or script directly. The method you mentioned—changing the Links Per Sitemap number and saving—is indeed the standard way to flush the sitemap settings.
However, if you want to automate this process, you could consider using a custom script that programmatically updates the options in the WordPress database. This would require some coding knowledge and access to your site’s backend.
Here’s a general approach you could take:
- Create a custom function that updates the
links_per_sitemap
option in the database.
- Use WordPress’s
wp_schedule_event
function to set up a cron job that calls this function at your desired interval.
If you’re not comfortable with coding, we recommend reaching out to a developer who can assist you with this.
Thank you for raising this concern! If you have any further questions or need assistance with something else, feel free to reply to this ticket, and a human agent from our support team will take over.
The bots reply was pretty good actually. Is this ChatGPT bot trained on your tickets?
Maybe your agents might have some code snippet ready? Otherwise I will speak with my developers
Hello,
Can you please confirm if your sitemap doesn’t update automatically? It mostly happens when your sitemap is heavily cached. In this case, you can apply the following filter to your site to disable the transients cache for the sitemap:
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Here’s how you can add filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Also, you can exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
https://rankmath.com/kb/exclude-sitemaps-from-caching/
Let us know how it goes. Looking forward to helping you.
Thank you.
Sitemap is updating automatically. However the problem is that some post types are not added to the sitemap until I do a refresh by adding a digit to Links Per Sitemap setting and this forces sitemap to add pages that I need.
I don’t know why particularly this type of posts is not added automatically without hard refresh
As one possible reason I would suspect the fact that this type of posts is added via WP All Import
Hello,
Does this issue persist after disabling the XML sitemap transient cache using the snippet shared by my colleague?
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Looking forward to helping you.
Thank you.
Thank you very much for the advice, it seems to be working
Hello,
We’re delighted to hear that this issue has been resolved. We appreciate your feedback.
This ticket will be closed now, but if you ever have another question or need any help in the future, please don’t hesitate to create a new forum topic. We’ll be more than happy to assist you again.
Thank you.