Yoast SEO
Yoast WordPress SEO Sitemap - exclude pages by ID# (6 posts)

  1. Haz
    Posted 2 years ago #

    Quick question about your sitemap. I want to include some pages, but exclude other pages...is there any way to do that? Can we exclude pages by ID number?


  2. Sith Lord Goz
    Posted 2 years ago #


    I searched the source files - it seems there is a filter available to exclude pages by ID - it's just not exposed through the UI.


    In your functions.php, if you hook this filter with a function that returns an array of page IDs, it should exclude them from the sitemap.

    However, I don't think this will work with Posts (vs. Pages) because that's a separate query and doesn't have an equivalent filter. Hopefully Yoast will just add a simple "exclude by ID" field to this excellent plugin :)

    Hope that helps!

  3. Sith Lord Goz
    Posted 2 years ago #

    Actually scratch that - that filter is only for the HTML sitemap that you can include in a page via a shortcode, it doesn't affect the XML SEO sitemap :(

    Let's hope the author adds this to a future version.

  4. Doug
    Posted 1 year ago #

    How did yoast missed this?
    I don't want noindex pages on my sitemap!

  5. Doug
    Posted 1 year ago #


    Go to edit post/page on advanced tab if you set the post(page to no index it will be automatically excluded.

    However ig you want to index it but just remove it from the sitemap you can also do that by selecting never include on sitemap option.


  6. jnz31
    Posted 1 year ago #

    thanks for pointing this out nicoblog.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic