[wp-hackers] prevent indexing of page 2,3 and so on

Rich ZenMaster richzenmaster at gmail.com
Fri Oct 22 06:49:05 UTC 2010


@alex,

This will probably prevent indexing of everything except homepage.

On Thu, Oct 21, 2010 at 11:30 PM, Alex Hempton-Smith
<hempsworth at gmail.com>wrote:

> Just hook into the <head> with wp_head, and use a conditional statement in
> that function:
>
> function my_plugin_head() {
>    if ( !is_home() )
>        echo '<meta name="robots" content="noindex, nofollow">';
> }
> add_action('wp_head', 'my_plugin_head');
>
> Untested, but should work.
>
> -- Alex
>
>
> On Fri, Oct 22, 2010 at 7:32 AM, Rich ZenMaster <richzenmaster at gmail.com
> >wrote:
>
> > Do you know how to prevent indexing of pages past the home page in WP?
> > I mean I don't want mysite.com/page/2, mysite.com/page/3 to be indexed.
> >
> > This is because I use home.php for my theme, so that page/2, page/3
> > are all the same.
> >
> > Please give me a hint or a code snippet please, I don't want to add
> another
> > plugin (robots meta).
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list