• Resolved richardu

    (@richardu)


    I use the filter that turns off the sitemap for certain CPTs, but some posts still show up in SERP.

    How do I noindex all posts in selected CPTs?

    Thanks, Richard

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @richardu,

    Excluding CPT from sitemap doesn’t tell search engines to not index them. It’s simply doesn’t send CPT’s URL to search engines. If search engines can discover posts in another way (by crawling your site), then they still can index them.

    To tell search engines to not index these posts, it’s better to use the robots tag. This snippet set robots tag to noindex for a CPT:

    add_filter( 'slim_seo_robots_index', function( $value ) {
        if ( is_singular( 'your_cpt' ) ) {
            return false;
        }
        return $value;
    } );
    Thread Starter richardu

    (@richardu)

    Thanks. That’s exactly what I needed. Perhaps this should be in your documentation.

    Cheers, Richard

    Plugin Author Anh Tran

    (@rilwis)

    Thank you, Richard. I’ve updated the docs.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Noindex all posts for custom post types’ is closed to new replies.