Previously, we showed you how to approve adsense in 2019 & beyond. The topic was so huge that it wasn’t possible to cover each and every small part in it. So, this separate tutorial is specially designed to help you understand how to add adsense verification code in WordPress header.
There are a lot of ways to add adsense to WP. But you need to grab the code & copy it first. Here is how to find adsense verification code:
- Go to adsense homepage.
- Click on “Sign in”.
- Login to your adsense publisher account by typing username & password.
- Then you will see a bunch of codes in a boxed area. That is the adsense verification code. You have to copy that code for your website.
Please Note: If you are not getting the adsense verification code, you might have signed up through Blogger or YouTube. That is known as the ‘Hosted AdSense Account’. In that case, you will need to upgrade your account to non-hosted. And once your account is fully approved, you can remove the adsense verification code anytime later.
How To Add AdSense Verification Code in WordPress header
Using Default Theme Options
This is one of the common solutions to add adsense verification code in WordPress. Many free and premium themes support this option by default. You can check if your theme supports features like custom adsense code or header & footer scripts.
To check if a theme supports custom codes, you can read its documentation, manual or official guide. Alternatively, you can go to WordPress dashboard & check for a menu called “Theme Options” on the left. There you can find proper place to add adsense verification code if your theme supports.
Using WordPress Editor
For this process, you will need to setup a child theme first. This will avoid removal of code when you update the theme. So, if you are already using a child theme, you are good to go.
First of all, login to your WordPress site dashboard. Then Navigate to Appearance >> Editor. On the right, you will find different theme files. From the list, Click on header.php. Then scroll through the editor & you should be able to find header code. Paste your adsense verification code below & save the file.
This method also requires a child theme to be enabled on your site. But if you never want to update your theme, you can continue editing the code on parent theme. But it is good to keep updating the theme whenever a new version is released to adapt bug fixes, changes & security improvements. So activate a child theme on your website before performing this step.
I believe most of the web hosting providers supports in-built file manager these days. So, there is no need for FTP client software. If your web hosting cPanel or dashboard does not supports default file manager, then use FTP software like ‘CuteFTP’ to access files on your server.
The FTP details like username, ip address & password can be found from hosting dashboard. If there is no such detail, then you might have to create a new FTP account from the same dashboard. Also, if your system supports, make sure to unlock FTP. This will allow the File Transfer Protocol software to connect with your server.
Once you have accessed the files, navigate to wp-content >> uploads >> themes >> (Name of your theme) >> header.php. Then you can download the file into your computer, edit it using ‘Notepad’ or any text editor, & re-upload it to the server. While editing the header.php file, you can easily find the codeif you search properly. There you can paste adsense verification code easily.
Plugins are very useful at some point. Although, they can break your site due to mis-configuration or unstable version, they are very handy if used with backups & precautions. Plugins can also slow down your website loading speed. So, use plugins only if there is no option left.
The good thing is, if the plugins are stable & does not affect your website performance, they can save a lot of time. So be careful before installing any kind of plugin into your website.
You can access the plugins area by going into Plugins >> Add New. Then search for ‘Insert Headers & Footer‘. When you find the proper plugin, click on install & then activate it. With that plugin, you can easily add the adsense verification code on wordpress header.
Finally, I hope the above methods helped you to place adsense in wordpress. If you haven’t applied for adsense yet, I suggest you to read my previous article on how to approve adsense. Also, let me know in comments if you are able to find the proper code & able to place it on your wordpress site.