Hot answers tagged

1

function noindex_comments_pages() { global $cpage; if (!empty($cpage) && $cpage > 1) { echo '<meta name="robots" content="noindex">'; echo "\n"; } } add_action( 'wp_head', 'noindex_comments_pages', 9 );


1

You can try the wp_head hook: add_action( 'wp_head', 'check_for_enviso_group_ticket' ); function check_for_enviso_group_ticket() { if ( is_product() && ( 'enviso_group_ticket' == get_the_terms( get_the_ID(), 'product_type' )[0]->slug ) ) { echo '<meta name="robots" content="noindex,nofollow"/>', PHP_EOL; } ...


Only top voted, non community-wiki answers of a minimum length are eligible