Ready to get started?Download WordPress


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

  1. Haz
    Posted 8 months 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 8 months 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 8 months 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.


You must log in to post.

About this Plugin

About this Topic