Support » Fixing WordPress » How to put noindex on category PAGES?

  • Resolved RedPitbull

    (@redpitbull)


    I want to put noindex atribute on category pages. With other words, I need the category indexed, but category/page-1 with no index.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    try it with this in your theme’s functions:

    add_action('wp_head', 'add_meta_paged_category_pages');
    function add_meta_paged_category_pages(){
    	if(is_category() && is_paged()) {
    		echo '<meta name="robots" content="noindex, follow">';
    	}
    }

    Thread Starter RedPitbull

    (@redpitbull)

    Thank you for your reply.
    I put it and got this error: Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING or T_VARIABLE or ‘$’ in http://&#8230;.

    Moderator keesiemeijer

    (@keesiemeijer)

    That’s strange, if I use it I get no errors.

    Can you post the content of your functions.php (with my code in it) here. See the Forum Rules on how to post code.

    Thread Starter RedPitbull

    (@redpitbull)

    I just had to put a ; somewhere. Now is working like perfectly.
    Thank you a lot for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to put noindex on category PAGES?’ is closed to new replies.