Exclude WordPress Search Results from Search Engines

Exclude WordPress Search Results from Search Engines

I’m usually frustrated when an online search returns another set of search results. Back in March, Matt Cutts spoke about this on his blog, and I’ve been meaning to ensure to exclude our cake search results from all search engines.

At first I thought about adding an exclusion in my robots.txt, but because the search results are built off of index.php, I figured a theme modification would be better.

To do this I added the following in my header.php:

<? if (is_search()) {?>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<? }?>
 

Short and simple…:)

Leave a Reply

Your email address will not be published. Required fields are marked *