-
Hello Michael,
Whereabouts are the .xml files stored in the SFTP directory structure?
-
Hello,
Thank you for contacting Rank Math today.
To find your sitemap XML files head over to Rank math>Sitemap settings and find the link as shown below:
Looking forward to helping you. Thank you.
Hi Michael,
I’m trying to remove a duplicate sitemap (an issue that’s been ongoing for several weeks now):
https://www.dropbox.com/s/j9vbaxqdxmjl2il/duplicate-sitemap-vpn.jpg?dl=0
When I turn off Products it removes one of the sitemaps, the other remains:
https://www.dropbox.com/s/j8q8jmweuiqxagn/products-off.jpg?dl=0
https://www.dropbox.com/s/uenlqtv42bkx93r/ecwid-sitemap-which-remains.jpg?dl=0
I thought I could delete this using SFTP, but it appears to be something to do with the code. The dev team are aware I believe, but I haven’t managed to get any resolution on this, so am continuing to look for a solution in the meantime.
Hello,
Thank you for contacting Rank Math today.
You can delete the local sitemap cache file by heading over to your sitemap cache folder in \wp-content\plugins\seo-by-rank-math\sitemap-cache folder.
The sitemap pages are however generated dynamically.
Looking forward to helping you. Thank you.
Hi Michael, thanks for getting back to me. I did that, but the sitemaps remain.
Hi Michael,
Thanks for the follow up.
Would you mind letting me know if you have already used the following filter and how it went:
/** * Filter decision if post type is excluded from the XML sitemap. * * @param bool $exclude Default false. * @param string $type Post type name. */ add_filter( 'rank_math/sitemap/exclude_post_type', function( $exclude, $type ){ return $exclude; }, 10, 2 );
We are looking forward to helping you. Thank you.
Hello Michael, thanks for getting back to me. Can you please advise how I should adapt the code to remove the product sitemaps? I’m not very familiar with php.
Hi there,
Thanks for the follow up.
You can use the following code:
/** * Filter decision if post type is excluded from the XML sitemap. * * @param bool $exclude Default false. * @param string $type Post type name. */ add_filter( 'rank_math/sitemap/exclude_post_type', function( $exclude, $type ){ if($type == "ec-product"){ return true; } return $exclude; }, 10, 2 );
I hope this info helps.
Hi Michael thanks very much for getting back to me. As there are two sitemaps – 1 called ec-product-sitemap and one called ecwid-sitemap, I guess there would need to be an and statement for “ecwid” too? I’m not a legend with PHP at all, so would this be correct? It’s highly likely my logic is wrong, but I need to somehow remove the both:
https://reclaimdesign.org/ec-product-sitemap.xml and https://reclaimdesign.org/ecwid-sitemap.xml
/** * Filter decision if post type is excluded from the XML sitemap. * * @param bool $exclude Default false. * @param string $type Post type name. */ add_filter( 'rank_math/sitemap/exclude_post_type', function( $exclude, $type ){ if($type == "ec-product" && $type == "ecwid") { return true; } return $exclude; }, 10, 2 );
I want to check with you first before running, because Bhanu sent me this code similar to the above and it resulted in a Critical Error in WP when I ran it:
Thanks for your assistance. I appreciate it.
Michael.
- This reply was modified 4 years, 8 months ago by Michael Martin.
Hi Michael,
Thanks for the rep;y.
You are on the right track, you can however change the && to an || as shown below:
/** * Filter decision if post type is excluded from the XML sitemap. * * @param bool $exclude Default false. * @param string $type Post type name. */ add_filter( 'rank_math/sitemap/exclude_post_type', function( $exclude, $type ){ if($type === "ec-product" || $type === "ecwid") { return true; } return $exclude; }, 10, 2 );
Once the code has been added, you will need to head over to Settings > Permalinks and click save and then head over to Rank Math > Sitemap settings and click save.
That should do it.
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.
The ticket ‘Location of Sitemap XML files’ is closed to new replies.