Support » Plugin: The SEO Framework » Rremoving pages from sitemap

  • Hi
    Is it possible to remove individual pages from being added to the sitemap created by SEO Framework? We have a membership site and some membership pages such as events are being added to the sitemap.
    Please advise.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Pierre LeBaux

    (@lebaux)

    Hi @aquaelle, you can exclude page/post/cpt with custom filter. First you need the page/post ID (how to find ID). Then you need to add this code into yours theme functions.php:

    add_filter( 'the_seo_framework_sitemap_exclude_ids', 'my_sitemap_exclude_ids' );
    function my_sitemap_exclude_ids() {
        $ids = 2; // Either a single integer
        $ids = array( 2, 3, 6, 10 ); // Or an array with integers
     
        return $ids;
    }

    Naturally, change the ids or array with your desired ID. You can find more useful filters in documentation. So if your page IDs are 343, 1240 your filter would look like:

    add_filter( 'the_seo_framework_sitemap_exclude_ids', 'my_sitemap_exclude_ids' );
    function my_sitemap_exclude_ids() {
        $ids = array( 343, 1240 ); // Or an array with integers
     
        return $ids;
    }

    Does this work for you? PS: If you like the plugin, consider rating/reviewing the plugin. Or don’t. I’m not your boss. Have a nice weekend! 🙂

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @aquaelle,

    I assume you don’t want users to find those pages through Google, either.

    Then, there’s also an easier way, but only if there’s an SEO meta box available for those pages. And that’s likely since the same visibility conditions apply for that meta box as there are for the sitemap.

    In the “… SEO Settings” meta box, under the Visibility tab, you’ll find the following option:
    Apply noindex to this Post

    When that option is set, two things will happen:

    1. The page will be removed from Google, Bing, etc.
    2. The page will be removed from the sitemap output

    That’s all there’s to it 🙂

    If you do wish for search engines to list that page, then I can’t find a good reason to exclude it for the sitemap. After all, it’s meant to be consumed by search engines.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Rremoving pages from sitemap’ is closed to new replies.