[wp-hackers] prevent indexing of page 2,3 and so on
    Charles K. Clarkson 
    cclarkson at htcomp.net
       
    Fri Oct 22 20:22:28 UTC 2010
    
    
  
On 10/22/2010 1:30 AM, Alex Hempton-Smith wrote:
> function my_plugin_head() {
>      if ( !is_home() )
>          echo '<meta name="robots" content="noindex, nofollow">';
> }
> add_action('wp_head', 'my_plugin_head');
is_home() should test true on the pages Rich wants to exclude.
add_action('wp_head', 'my_plugin_head');
function my_plugin_head() {
     $current_page = get_query_var('paged') ? get_query_var('paged') : 1;
     if ( is_home() && 1 < $current_page )
         echo '<meta name="robots" content="noindex, nofollow">';
}
HTH,
Charles Clarkson
-- 
Mobile Home Investor
Free Market Advocate
Programmer
I'm not really a smart person. I just play one on the Internet.
Stephenville, TX
http://twitter.com/CharlesClarkson
+1 (254) 968-8328
    
    
More information about the wp-hackers
mailing list