Hello,
Thank you for contacting us and bringing your concern to our attention.
In order to remove the shop page from your sitemap, please use the following filter on your website:
add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
if ($post_type == 'product'){
$archive_url = false;
}
return $archive_url;
}, 10, 2 );
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how it goes. Looking forward to helping you.
Thank you.
I added this code and it has no impact.
Also, i don’t want to remove all the products but only that shop page at https://ellasbubbles.com/shop/ only
Hello,
The filter above should remove your shop page from your product sitemap.
If it’s still showing, please follow these steps to flush your sitemap cache:
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp
2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
https://rankmath.com/kb/exclude-sitemaps-from-caching/
3. Disable the transient cache for the sitemap by applying this filter. This will make sure that your XML sitemap always reflects the latest changes on your site:
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
If you’re not sure how to add this code, you can follow this guide:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Looking forward to helping you.
Sure, will try this out. But are you sure that it will not remove all the products from the sitemap and only the shop page?
Hello,
Yes, the filter only targets the archive URL (which is your shop page) and removes it from the sitemap.
All other products will still remain in your product sitemaps.
Looking forward to helping you.
Hello,
The filter targets the ‘product’ post-type archive specifically and will not remove products from the sitemap.
If the archive page for ‘product’ is set to ‘shop’, this filter will remove the ‘shop’ URL from the sitemap.
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Thank 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.