• Dear Yoast team

    I would like to know if it’s possible to alter the query for sitemap generation for a post type.
    I need to ensure that child posts are not within the sitemap for my ‘product’ post type.
    I can’t seem to find a way. Do you have a suggestion?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Mushrit Shabnam

    (@611shabnam)

    Hi @mrommel

    Are you asking how you can remove some of the products from the product sitemap? If yes, you can try one of the following ways to achieve this:

    1. You can exclude a particular post type using the filter wpseo_sitemap_exclude_post_type. You can learn more from the developer article

      Typically code snippets are added to your theme’s functions.php file. If you’re unfamiliar with using code snippets, we’d like to refer you to the WordPress documentation on how to use a filter.

      We recommend creating regular backups of your site and database for your site’s health and safety. A backup is crucial before making important changes on your website and provides you with a safety net if something were to go wrong. Learn more about the benefits of regular backups.
    2. You can change the canonical URL of the product that you would like to remove from sitemap. So you can use the URL of the parent product as the canonical URL for child product.
    3. You can noindex the product and it will be removed from sitemap.

    Feel free to let us know if I am not picking up the question correctly.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.