Remove meta robots tag from wp_head

I am in need to remove just this line <meta name=robots content="noindex,follow"/> from wp_head but can’t find the right hook to use it with remove_action().

<meta name=robots content="noindex,follow"/>

Basically what I want to achieve is to remove just this line from the header but just for the search page. So in this case I would use something similar to:

if ( is_search() ) { remove_action('wp_head', 'whatever-the-action-name-is'); }

5 s
5

add_filter('wpseo_robots', 'yoast_no_home_noindex', 999);
function yoast_no_home_noindex($string= "") {
    if (is_home() || is_front_page()) {
        $string= "index,follow";
    }
    return $string;
}

this should be fine i think.. somewhere in your theme functions.php and should do the trick.

Leave a Comment