Noindex Search Result Pages
Asks search engines not to index your internal search result pages, which are thin, endless and a favorite target for spam links.
Opens WPIDE on
Code
add_filter( 'wp_robots', function ( $robots ) {
if ( is_search() ) {
$robots['noindex'] = true;
$robots['follow'] = true;
}
return $robots;
} );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.