Skip to main content
Home / Code Snippets / WordPress / Prevent Search Bots from Indexing Search Results

Prevent Search Bots from Indexing Search Results

In the <head> section of your header.php file:

<?php if(is_search()) { ?>
   <meta name="robots" content="noindex, nofollow" /> 
<?php }?>
icon-link icon-logo-star icon-search icon-star