Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter cosmedia

    (@cosmedia)

    I removed it from the google index once but it just comes back

    Plugin Contributor Mike Jolley

    (@mikejolley)

    function shop_noindex_but_not_home(){
    	if ( ! is_front_page() && is_post_type_archive( 'product' ) ) {
    		echo '<meta name="robots" content="noindex,follow" />';
    	}
    }
    add_action( 'wp_head','shop_noindex_but_not_home', 4 );
    Thread Starter cosmedia

    (@cosmedia)

    Where do i put this?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Theme functions.php

    Thanks for posting this – I had the placeholder shop page marked as noindex in Yoast SEO, but it’s the product archive that Google indexes.

    What would I need to change in the function above if I want to do the same thing but the page is NOT the front page?

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The above snippet does just that. It adds the meta tag if it is not the front page.

    Nice, thanks very much.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Products Archive page, how to noindex’ is closed to new replies.