Sitemap: Excluding Shop-Page doesn’t work

#438640
  • Resolved Kai Lehmann
    Rank Math free

    Hey folks,
    I’d like to exclude my shop-page from the (products-)sitemap, because it’s a one-product-shop and there is a redirection on this page.
    I’m using the post-id for that page to exclude it, but that doesn’t work.
    Any ideas?
    Best regards, Kai
    Productsitemap

Viewing 6 replies - 1 through 6 (of 6 total)
  • The inserted image-link “Productsitemap” doesn’t work. How can I attach an image easyly?

    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.

    Our plugin includes the post-type archive link as the very first URL in the different sitemaps, and that page is the archive page for the products.

    To remove it, you would need the following filter:

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
        if($post_type == 'product') {
            return false;
        }
        return $archive_url;
    }, 10, 2 );

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    Thank you.

    Hi and thanks for your reply!
    I inserted the code into my child themes functions.php – but nothing changes.
    Do I have to something else? Or just wait?
    Best regards!

    Anas
    Rank Math business

    Hello,

    Please flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    Once done, clear your website cache and check the sitemap.

    Hope this helps.

    Thank you.

    Yeah! That’s it!
    Thank you very much!

    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.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘Sitemap: Excluding Shop-Page doesn’t work’ is closed to new replies.