Struggling to verify your WordPress blog with Google webmaster tools (search console)?
Here is a super simple method using which you can verify your site within five minutes right within your wordpress dashboard!
So let's begin:
1: Create a child theme (Optional)
This first step is optional but is highly recommended.
Here's why..
You see, Google wants to make sure that you own the website that you want to add to webmaster tools. For this, Google wants you to verify your ownership using a few different options. One of the easiest options, is to verify using HTML tags. This method requires you to add a Meta Tag to the head section of your website.
To do that, you will need to edit your theme's functions.php file.
Even though you can edit your theme's functions.php file, it is a good practice to avoid editing your main theme. This is because, if the main theme updates itself, all changes you made to it will be over written. In other words, you will need to re-add the Meta tags to your blog's head section by editing your theme's functions.php file.
To avoid this, you can create a child theme which acts as a subsidiary to your main theme and then edit that child theme instead. This way, all your edits remain intact irrespective of theme updates.
The simplest way to generate a child them for your main theme is to install the 'Child theme generator' plugin by Serafino Corriero.
Here are the steps to add and configure the plugin to create a child theme:
Step 1: Login to your WordPress dashboard and go to Plugins > Add New (left panel of your dashboard) and search for 'Child theme generator'. Make sure that the author name is 'Serafino Corriero'.
Step 2: Install and activate the plugin.
Step 3: Go to 'Settings > Child-Theme Gen' (From the left panel).
Step 4: Your current theme will automatically be selected. Simply enter a name for your child theme and click 'Create new child theme'.
Step 5: Check the 'Activate child-theme' checkbox and click 'Finished'.
That's about it. You have now created a child theme for your main theme.
Note: As mentioned earlier, if you do not want to install a child theme, no worries. You can skip this step and proceed to step 2.
2: Add your website in Google Webmaster Tools
Here are the steps to do this:
Step 1.) Login to Google search console.
Step 2.) Enter your complete website URL and click 'Add a property'.
Note: A simple way to find your correct website URL is to open a browser and visit your website by going to 'sitename.com' (replace sitename.com with your website url). Once your website loads, copy the website URL in the browser window and paste it in the space provided.
Step 3.) On the verification page, click on 'Alternate Methods' tab.
Step 4.) Select 'HTML Tag' as your verification method.
Step 5.) Copy the meta tag that appears.
3: Add the meta tag to your wordpress blog
The final step is to add the meta tag to your wordpress blog. Here are the steps to do this:
Step 1: In your wordpress dashboard, go to Appearance > Editor.
Step 2: Click on 'Theme Functions (functions.php)' file from the left panel.
Step 3: Copy and paste the following code to your functions.php file:
function orweb_add_gsc_meta_tag(){
if( ! is_home() || ! is_front_page() ) return;
#replace your meta tag below
echo '<meta name="google-site-verification" content="BVmbiuY" />';
}
add_action( 'wp_head', 'orweb_add_gsc_meta_tag' );
Important Note: Make sure to replace your meta tag in the code!
4: Click 'Update file'.
4: Verify your site
Now that you have added the meta tag, you can easily verify your site.
Simply, go back to Google search console, make sure that 'HTML tags' under 'Alternate Methods' is selected. Scroll down and click the 'Verify' button.
That's it, you have now verified your site with Google webmaster tools!
You should be able to see your site data within a few days of adding your website.