Hello,
Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.
You can use the below filter to exclude specific URLs from your sitemap. Make sure to put the code inside your themes function.php
file.
add_filter( 'rank_math/sitemap/xml_post_url', function( $url, $post){
if('http://yoururl.com/slug-of-your-post/' !== $url) {
return $url;
}
}, 10, 2 );
Make sure to replace the URL inside the filter code.
Please flush the Sitemap cache by following this video screencast after pasting the code:
https://i.rankmath.com/pipRDp
Looking forward to helping you. Thank you.
Hello, thanks for your help. This is not a post. It’s a Thrive Apprentice Course.
https://ibb.co/wpSBY5B
The solution is not working, plus I would need to add 5 URLs, not just one.
I’ve added the filter to functions.php:
https://ibb.co/zXjxFSG
And changed to 201 under sitemap and saved the permalinks.
The URL is still in the sitemap
https://ibb.co/fSHZG7R
Thanks!
Hello,
Thank you for your reply.
Since you only want to remove the URLs, Please head over to WP Dashboard > Rank Math >Sitemap settings >General > Exclude Posts and Enter post IDs of posts you want to exclude from the sitemap, separated by commas.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello, I already tried that, and it doesn’t work. These are not posts nor pages, they are Thrive Apprentice courses.
Check this URL please (it’s the same type of page): https://classyfunnels.com/cursos-de-marketing/crea-una-oferta-irresistible/
The ID is “term-205”
<body class=”archive tax-tva_courses term-crea-una-oferta-irresistible term-205 logged-in admin-bar wp-custom-logo theme-thrive-theme woocommerce-js tve-theme-81 thrive-layout-30 customize-support tve-desktop-browser tve-chrome-browser”>
If I add term-205 in the exclude posts input field, it will not exclude the page from the sitemap.
Thanks
Hello,
Thank you for your reply.
It looks like those are not the correct values. You can get the Post ID on the post edit page.
Please see the screenshot below:
https://ibb.co/9498T0c
Please do let us know how that goes.
Looking forward to helping you.
Hello Ankit, thanks for your help.
This was a tricky setup as these “posts” did not have a data-post-id in them, they were there, but they were not published, so I had nothing to grab them except the URL.
But I found a way to “publish them” and by doing so, they were added the post-data-id.
Then it was easier just to delete them than to remove from the sitemap.
BTW, you may want to take a look at this for future tickets including Thrive Apprentice, even adding the data-post-id to the “exclude posts” in Rank Math they were not excluded from the sitemap, they were only excluded when I deleted them.
Thanks!
I’ve added the IDs in the fields (yesterday):
https://ibb.co/ZSr4Qm9
But the pages are still shown in the sitemap:
https://ibb.co/R0nt74K
Hello,
Thank you for your reply.
I’ve removed the Resolved status from the ticket.
Please provide your logins again so that we can further investigate the issue.
Looking forward to helping you.
Thanks.
Ankit, sorry, it seems my messages got mixed up. This was my last message:
Hello Ankit, thanks for your help.
This was a tricky setup as these “posts” did not have a data-post-id in them, they were there, but they were not published, so I had nothing to grab them except the URL.
These are not courses that you see in “draft” they are just not there.
But I found a way to “publish them” and by doing so, they were added the post-data-id.
Then it was easier just to delete them than to remove from the sitemap.
BTW, you may want to take a look at this for future tickets including Thrive Apprentice, even adding the data-post-id to the “exclude posts” in Rank Math they were not excluded from the sitemap, they were only excluded when I deleted them.
Thanks!
Hello
Sorry for catching up so late.
I am glad that you found a way to fix this problem.
Please do not hesitate to let us know if you need our assistance with anything else.