How to adjust (or disable) Meta-Robots for Comment-URLs?
-
Hi there!
It would be wonderful if someone could enlighten me about the use of meta-robots for comment-urls in Yoast.
As you can see in the source code of these example URL:
https://www.bussgeldkatalog.org/geschwindigkeitsueberschreitung/comment-page-2/
https://www.bussgeldkatalog.org/geschwindigkeitsueberschreitung/comment-page-3/two contradicting meta-robots commands are played out. The first one says “noindex”, whereas the second one from Yoast says “index”. There should be one unique meta-robots tag for these comment URLs saying “noindex, follow”.
How can I possibly make Yoast either turn its “index, follow” meta-robots tag into a “noindex, follow” one or, even better, completely disable Yoast meta-robots only on comment URLs?
Surfing on the web I found a code-snippet that could help me with the latter:
add_filter( ‘wpseo_robots’, ‘yoast_seo_robots_remove_single’ );
function yoast_seo_robots_remove_single( $robots ) {
if ( is_single ( 123456 ) ) {
return false;
} else {
return $robots;}
}The problem is that I have no idea how to change “is_single ( 123456 )” into a different identifier, which includes all the comment URLs, and nothing else.
Looking forward for any valuable hints!
Stay positive & test negative,
RomanThe page I need help with: [log in to see the link]
- The topic ‘How to adjust (or disable) Meta-Robots for Comment-URLs?’ is closed to new replies.