Unindex Search Plugin

Even though I use Google Custom Search for my blog, I get a lot of WordPress's internal search results pages indexed by robots.  Didn't want that to happen anymore, so I wrote a simple plugin to address the issue.  Maybe someone will find it useful:

<?php
/*
Plugin Name: Unindex Search
Plugin URI: http://www.barneyb.com/
Description: Addes a NOINDEX meta tag for search result pages
Author: Barney Boisvert
Version: 0.1
*/
add_action('wp_head', 'unindexsearch_head');
function unindexsearch_head() {
  if (is_search()) {
    ?><meta name="robots" content="NOINDEX" />
    <?php
  }
}
?>

Simply checks if it's a search page and if so writes out the META tag.

Comments are closed.