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; } ...


1

I don't know if it's any more elegant, but if you don't like duplicating the HTML code, you could do this: function prefix_poweredby() { $html = '<a href="https://example.com"'; if ( ! is_front_page() ) { $html .= ' rel="nofollow"'; } $html .= ' target="_blank">link</a>'; echo $html; } ...


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