Keep tag, date and author archives out of Google
Tag, date and author archive pages ask search engines not to index them (links on them are still followed). Search results show your posts instead of lists of them.
<?php
add_filter(
'wp_robots',
static function ( $robots ) {
if ( is_tag() || is_date() || is_author() ) {
$robots['noindex'] = true;
$robots['follow'] = true;
}
return $robots;
}
);
Good to know
Categories aren’t included: they’re often worth indexing. SEO plugins have this as a setting.
In these packs
- SEO basics: Meta descriptions, social sharing tags, article structured data and cleaner indexing, for sites without an SEO plugin.