Noindex paginated pages in Yoast SEO

Since the version 7.0 of the most downloaded and popular WordPress Plugin – Yoast SEO started paginated pages indexation by default. Meaning search engines like Google will index your paginated pages.

For example: /page/2/ย or /page/3/ย etc pages will be indexed by search engines and will show up on SERP by default. Previously you could disable it from the settings but that is no longer the case.

Some like it, some don’t. Personally I don’t like this at all. I don’t like paginated pages to be indexed by search engines because it hurts SEO of your actual posts. Fortunately you can disable it by adding some few line of codes in the theme’s function.php of your WordPress setup.

The following code will automatically add noindexย tag on all the paginated pages, hence the search engines are not going to index them. If they already did index them, they’re gonna noindex them very soon.

// no-index tag for paginated pages for Yoast SEO => 7.0
add_filter( 'wpseo_robots', 'no_index_paginated_pages' );
function no_index_paginated_pages( $string ) {
    if ( is_paged() ) {
        return 'noindex, follow';
    } else {
        return $string;
    }
}

Once you added them you can check if the code is working by looking into the source code of a paginated pages. I hope this helps. โœŒ

Share your thoughts by leaving a comment below.