Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
Could you please share your sitemap URL and the filter you have created so we can check?
You can paste the code here and share the pastebin URL in the sensitive data section.
It is completely secure, and only our support staff has access to that section.
Meanwhile, for initial troubleshooting, please make sure that your sitemap is not getting cached. Please follow these steps:
1. Ensure you’re using the latest version of your plugins/theme including the Rank Math plugin.
2. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/xXXhDt
3. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server:
https://rankmath.com/kb/exclude-sitemaps-from-caching/
Looking forward to helping you.
Thank you.
i only want to add custom sitemap to sitemap_index.xml
Hello,
Please add this filter to the website and see if this gives you the desired output:
add_filter( 'rank_math/sitemap/index', function( $xml ) {
$xml .= '
<sitemap>
<loc>http://example.com/new-sitemap.xml</loc>
<lastmod>2020-09-14T20:34:15+00:00</lastmod>
</sitemap>';
return $xml;
}, 11 );
Replace http://example.com/new-sitemap.xml
in the above filter with the custom sitemap URL.
You can follow this guide to add the code to the website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Once the code is added, please follow this screencast to flush the sitemap’s cache and then check the sitemaps to see if the custom sitemap link is added to the index sitemap: https://i.rankmath.com/pipRDp
Let us know how that goes.
Thank you.
Hello,
Glad that helped.
Please feel free to reach out to us again in case you need any other assistance.
We are here to help.
Thank you.