Google Webmaster - New META tag name for verification

10 months ago | elescondite (Member)

It appears that google has changed the name of the tag for verifying a site in Webmaster Tools. The current code in google_webmaster.php sends:

<meta name="verify-v1" content="your_code_here" />

but google now wants:

<meta name="google-site-verification" content="your_code_here" />

The quick fix is to find the appropriate line (47) in wp-content/plugins/headspace2/modules/site/google_webmaster.php and add a new line under it with the new tag format. Having both versions will not hurt anything and will ensure that the plugin will work across old and new sites.

Read responses...

Responses

  1. remorhaz:

    Posted 9 months ago by Member

    When I discovered this problem I patched google_webmaster.php quickly to implement selectable meta tag name.

    class HSS_GoogleWebmaster extends HS_SiteModule
    {
    ...
    var $metaname = 'verify-v1';
    ...
    function wp_head ()
    {
    // Only need to put this on the home page
    if ($this->code && is_front_page ())
    echo '<meta name="'.htmlspecialchars($this->metaname).'" content="'.htmlspecialchars ($this->code).'"/>'."rn";
    }

    function load ($data)
    {
    if (isset ($data['code']))
    $this->code = $data['code'];

    if (isset ($data['metaname']))
    $this->metaname = $data['metaname'];

    }
    ...
    function save_options ($data)
    {
    return array (
    'code' => $data['code'],
    'metaname' => $data['metaname'],
    );
    }

    function edit ()
    {
    ?>
    <tr>
    ...
    </tr>
    <tr>
    <th width="150"><?php _e ('Meta tag name', 'headspace'); ?>:</th>
    <td>
    <select name="metaname">
    <?php
    foreach (array(
    'verify-v1',
    'google-site-verification',
    ) as $metaname) {
    ?><option<?php if ($metaname == $this->metaname) { ?> selected="selected"<?php } ?>><?php echo htmlspecialchars ($metaname); ?></option><?php
    }
    ?>
    </select><br />
    <span class="sub"><?php _e ('Select meta tag name.', 'headspace'); ?></span>
    </td>
    </tr>

    <?php
    }

    }

  2. Nik Cree:

    Posted 6 months ago by Member

    Thankyou. I added the extra line:

    echo '<meta name="google-site-verification" content="'.htmlspecialchars ($this->code).'"/>'."rn";

    under line 47 and it worked a treat.

  3. Gil:

    Posted 2 months ago by Member

    Nick Cree,
    I added the line of code you show under line 47 but there is an error. At the very end instead of: "rn"; it should have a backslash before the r and another backslash between the r and the n.

    What happened in my case is that after I placed the code the way you show, the letters 'rn' appeared above the Logo Area of my WP theme. I only found out why those letters were appearing 6 weeks later. Whats strange is that my website lost 60% of its indexed pages during this period. Now that I fixed the problem, I'm beginning to gain indexed pages again. Coincidence?

    EDIT: For some strange reason this post area does not show backslashes, meaning that Nick Cree's line of code probably had the 2 backslashes, but after we click on "Edit Post" they (backslashes) disappear.

    Urban Giraffe Support should look into this problem, as it made me waste almost quite a bit of my time as well as hundreds of backlinks.

  4. Nik Cree:

    Posted 2 months ago by Member

    @Gil

    Yes you are right. I did have the back slashes in and they were stripped out.

Reply

You must log in to post.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2010