I need to remove this line <meta name="robots" content="index, follow">
on my site for the accessibility mode.
I successfully added the <meta name="robots" content="noindex, follow">
by calling add_action( 'wp_head', 'wp_no_robots', 1); but it shows both metatags
<meta name="robots" content="noindex,follow"> <meta name="robots" content="index, follow">
I didn't find the way to remove the index metatag line.
I need to remove this line <meta name="robots" content="index, follow">
on my site for the accessibility mode.
I successfully added the <meta name="robots" content="noindex, follow">
by calling add_action( 'wp_head', 'wp_no_robots', 1); but it shows both metatags
<meta name="robots" content="noindex,follow"> <meta name="robots" content="index, follow">
I didn't find the way to remove the index metatag line.
Share Improve this question edited Feb 26, 2021 at 16:12 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Feb 26, 2021 at 15:28 princeexpeditionprinceexpedition 237 bronze badges 4 |1 Answer
Reset to default 1Rather than using the
add_action( 'wp_head', 'wp_no_robots', 1 );
Try using
add_filter( 'wp_robots', 'wp_robots_no_robots' );
In your code you are actually trying to add one more function call to pre called function rather than just changing its value to noindex. Use add_filter instead. :)
plugin-all-in-one-seo
- are you using the plugin? – kero Commented Feb 26, 2021 at 15:33