Site logo

Archived topic

Deindexing paginated archive pages (NOT PAGE 1 of an ARCHIVE!)

7 replies · Started by Mark on February 8, 2023

Viewing posts 1–8 of 8

Hi there,

I just want to make sure if this code will do the trick. I'm trying to save crawl budget and I don't think anything after page 1 in an Archive needs to be indexed. In fact, deindexing anything after page 1 should help SEO?

This would go into functions.php

1) Can you confirm the code will work

2) Is there any way to test to see if it worked other than waiting to see what Google displays in a search?

3) Do you think this is a bad idea?

URL examples in the private area.

Thanks in advance!
Mark

Ok, will check it out.

Will the code work?

Which code? I don't think a code was shared.

Whoops, sorry! Here it is:

/*
==================
Set Sub-Pages of Archives to Noindex
==================
*/

function mtt_noindex_paged() {
if ( is_paged() ) {
echo '<meta name="robots" content="noindex,follow" />';
}
}
add_action('wp_head', 'mtt_noindex_paged');

/*
==================
END OF Set Sub-Pages of Archives to Noindex
==================
*/

Thanks Fernando. Will check that out

You're welcome, Mark!

This archived topic is closed to new replies.