Hello,
We apologize for the issue you are facing with your sitemap. To remove links from your sitemap in Rank Math, you can use a filter in your theme’s rank-math.php
file. Here’s a code snippet that you can add:
add_filter('rank_math/sitemap/entry', function ($url){
// Add your conditions here to determine which links to remove
if (/* condition to remove link */) {
return false;
}
return $url;
});
You will need to specify the condition under which you want to remove the links. If you need more detailed guidance on how to implement this or if you’re looking for a specific setup, we recommend checking out our sitemap configuration tutorial for more information.
If you would like comprehensive assistance, consider our professional setup service available at Rank Math Services. This service requires a PRO subscription and ensures your plugin setup is fully correct and adheres to the latest SEO standards.
Thank you for raising this concern! If you have any further questions or need additional help, please reply to this ticket, and a human agent will assist you shortly.
Sources:
Remove Blank Lines From Sitemaps » Rank Math
Hello,
Thank you for your query and we are so sorry about the trouble this must have caused.
Besides the more advanced filter code method Rankbot shown above, you can also set your posts/pages to noindex or set the Canonical URL pointing to other pages to remove them from the sitemap.
After doing so, please clear your sitemap caches and check again.
In addition, you may follow this guide for more ways to remove or exclude links/pages from sitemap: https://rankmath.com/kb/exclude-content-from-sitemap/
Looking forward to helping 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.