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.

  • You've tagged this question with plugin-all-in-one-seo - are you using the plugin?
    – kero
    Feb 26, 2021 at 15:33
  • 1
    Nope, I do not use any plugin for <meta name="robots" content="index, follow">. But I am using a custom plugin for enabling/disabling to the accessibility mode where I simply adding these lines add_action( 'wp_head', 'wp_no_robots', 1); I kept looking the way to remove the robots metatag. even through I tried this statement remove_action( 'wp_head', 'robots'); but no luck so far. Feb 26, 2021 at 15:46
  • Ok, sorry but I can't help you with that as I'm unfamiliar with the core robots stuff. Somebody else will probably pick it up - just wanted to make sure it is about WP core and not a plugin.
    – kero
    Feb 26, 2021 at 16:05
  • 1
    – birgire
    Feb 26, 2021 at 23:00

1 Answer 1


Rather 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. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.