Hello,
Thank you for getting in touch with us.
The Search Engines are pinged when the sitemap gets updated if the option is enabled in Rank math > Sitemap Settings.
Rank math sitemap gets updated each time a post or a page set to index is published and therefore so does the pinging.
I hope this helps you.
I will try to explain to you my specific situation.
I have a separate table on my site that stores my listings. These listings (custom pages) are not built-in WordPress types. WordPress does not recognize this data as its own and does not know anything about it. The display of these pages occurs through the setting of rules (rewrite_rule). Therefore, the Rank Math plugin does not have access to these pages either. I learned how to create sitemaps for these pages, as Balazs showed in this ticket (https://support.rankmath.com/ticket/creating-a-new-custom-sitemap/).
These pages change every 2-3 days, and therefore I need a mechanism in Rank Math that will allow me to programmatically delete old sitemaps and after creating new ones (I already know how to do this), notify the search engine about new sitemaps (ping).
Is there some event or hook that I can use to force the notification?
Can you help me with this?
Thanks for the help!
Hello,
You can use flush_rewrite rules()
function to clear the Sitemap cache. Or you can disable the Sitemap cache by adding the following function in your theme’s functions.php file:
https://rankmath.com/kb/filters-hooks-api-developer/#enable-disable-sitemap-cache
You can set it to false to disable the Sitemap cache.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thanks Uzair, but your advice didn’t help me.
I examined the code of your plugin and I see that the ping_search_engines() function is used internally. This is what I need!
This function can be run using the hook (‘rank_math/sitemap/ping_search_engines’).
Why didn’t you write anything in the documentation about this functionality?
Hi there,
It was an oversite from our end, the documentation was not provided for it as its not been update in a while.
Apologies for that.
Will get it documented soon but use it to your advantage.
Cheers.
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.