admin管理员组

文章数量:1122846

Bit of a strange one. One of my clients site is showing <meta name='robots' content='noindex,follow' /> in the head. The Search Engine Visibility checkbox is unchecked.

I've tried activating 2019 theme and deactivating all plugins and still the tag shows.

Never encountered this before. Any ideas?

Bit of a strange one. One of my clients site is showing <meta name='robots' content='noindex,follow' /> in the head. The Search Engine Visibility checkbox is unchecked.

I've tried activating 2019 theme and deactivating all plugins and still the tag shows.

Never encountered this before. Any ideas?

Share Improve this question asked Apr 9, 2019 at 19:09 Luke SeallLuke Seall 3303 silver badges17 bronze badges 2
  • 1 In wordpress.stackexchange.com/q/333807/30597 someone had the same problem. Turned out former dev hacked core header template. – leymannx Commented Apr 9, 2019 at 19:12
  • I replaced all the core files with fresh updated version. Didn't fix it. – Luke Seall Commented Apr 9, 2019 at 19:23
Add a comment  | 

2 Answers 2

Reset to default 0

Check to make sure the blog_public option in the options table is set to 1. If that looks right, make sure nothing is adding that tag via the wp_head action. Also make sure this isn't being set by any plugins. This is common for SEO plugins.

To switch from noindex to index from inside a template:

    <?php 
        global $wp_filter;
        foreach($wp_filter['wpseo_robots_array']->callbacks[10] as $k => $v){
            $robots = $v['function'];
        }
        remove_filter( 'wpseo_robots_array', $robots );
    ?>

see: https://github.com/Yoast/wordpress-seo/blob/f6719d2e5d6eb173ab6a9ca63093b422582d66be/src/integrations/front-end/indexing-controls.php#L53

Or, much easier:

update_option('blog_public', 1);

本文标签: Can39t remove noindex meta tag from head