Learn how to Add Google AdSense to a WordPress Site in this post.

How to Add Google AdSense to a WordPress Site

Want to know how to add Google AdSense to a WordPress site?

If you plan on monetizing your website, one of the many avenues you can take is to run ads on your site.

That’s where Google AdSense comes in.

What is Google AdSense (and Why Should You Consider It)?

Google AdSense is an online advertising network that enables publishers, content creators, and website owners to monetize their websites by displaying relevant ads to their visitors. Because the ads are highly targeted, they’re usually effective and bring the advertisers a good return on ad spend (ROAS). As a result, the demand for ad space is always high.

Google AdSense is the best way to go for publishers who want to cash in on the high demand for ad space. One reason is that it’s the largest advertising network and therefore offers more opportunities to both publishers and advertisers. Another reason you should consider Google AdSense is that it’s hassle-free. You don’t have to deal directly with advertisers. Instead, Google handles all publisher/advertiser relationships, including collecting payments on your behalf. 

Setting Up Your AdSense Account

Ready to add Google AdSense to your WordPress site?

The first step to adding Google AdSense to your website is to sign up for an AdSense account. If you already have a Gmail account, you can use that account to sign up. You’ll then be asked to fill out a super short form.

The Google AdSense team will then review your application, a process that may take anything from a few hours to weeks. However, you can still get a snippet of code you can paste on your site to verify and connect it to AdSense.

To get the code, click on the “Get code” button and a page with a snippet of code will open:

When learning how to Add Google Adsense to a WordPress site you'll need to copy a snippet of code from AdSense to your website.

You’ll have to place the code on your website to start displaying ads. We’ll see how to do that in a  moment.

What Happens if Your Account Isn’t Approved?

Sometimes, your application for a Google AdSense account can get rejected. When this happens, Google will send you an email explaining why your account application was disapproved. In many cases, the rejection may be due to issues regarding your website. Examples include:

  • Lack of content/poor quality content
  • Security issues
  • Plagiarized content

Google is in the business of selling ad space to the highest bidder. Because of this, they want to know that the ads are being placed on high-quality websites that attract quality traffic. This is why they’re strict about website quality.

What do you do when your application is disapproved?

Instead of immediately reapplying, consider auditing your site first. Find any issues that may be the cause and fix them. Work on any security issues you find and publish content that meets Google’s quality rater guidelines.

Once you’re satisfied that you’ve solved the problems Google highlighted, you can reapply for an AdSense account.

However, whatever the case, you don’t have to wait until your account is approved to connect your website to Google AdSense. 

Let’s get to it then, shall we?

How to Manually Place the Google AdSense Verification Code in WordPress

Besides using a plugin to connect your Google AdSense to WordPress, you can also do it manually. This will require you to edit your theme code — nothing heavy, though.

Remember the code you got as you were setting up your AdSense account?

This is where you’ll need it.

To connect your Adsense to your WordPress site, you’ll first have to click on the “Appearance” tab in your WordPress dashboard and select “Theme Editor.”

knowing how to add Google AdSense to a WordPress site involves editing your theme's header.php file.

Once you’ve opened the theme editor, select the header.php file under the “Theme Files” section. Place your AdSense code just above the </head> tag.

Add the code just above the header tag in your header.php file.

Once done, click “Update File,” and that’s it!

Editing your theme’s code is not recommended, especially if you’re not familiar with editing theme files and code.

What’s the recommended route?

Use a plugin to place your Adsense verification code in your header and footer.

Using a Plugin to Place the Google AdSense Verification Code in WordPress

Plugins make life easy for website admins. Fortunately, there’s a plugin for every function you may want to perform on your WordPress website. That includes connecting your AdSense to

How to Add Google AdSense to a WordPress Site Using the Insert Header and Footers Plugin

One of the easiest ways to connect Google Adsense to your WordPress site is to use a plugin like Insert Header and Footers by WPBeginner.

Once you’ve installed and activated the Insert Header and Footers plugin, go to the “Settings” tab in your WordPress dashboard. Then, click “Insert Header and Footers”:

You'll find Insert Header and Footers under the settings section of your WordPress dashboard.

When you open the “Insert Headers and Footers” link, you’ll be led to a page with three empty spaces where you can enter code snippets. 

Paste your AdSense code in the “Scripts in Header” box.

Paste your Google AdSense verification code in the “Scripts in Header” box and click “Save.”

Just like that, you’ve added the Google AdSense verification code to your WordPress site. Your site is now connected to Google AdSense.

How to Add Google AdSense to a WordPress Site Using the Advanced Ads Plugin

One of the easiest ways to connect Google AdSense to your WordPress site is to use a plugin. While there are many you can use for this, we highly recommend Advanced Ads. It’s easy to use and offers more flexibility than most plugins in the same category.

The biggest advantage of using a plugin is that you don’t have to mess with the code on your website. Another advantage is that a plugin can manage the process of managing the process of displaying ads without you using widgets. Advanced Ads also gives you a Gutenberg block for ads. This makes it easier to place ads wherever you want to in your posts.

How do you connect your WordPress site to Google AdSense using a plugin?

First, you must install and activate the Advanced Ads plugin. Once installed, head over to the plugin settings and click on the AdSense tab.

The Advanvced Ads plugin is another easy way to connect Google AdSense to a WordPress site.

Click on the “Connect to AdSense” button, and you’ll be prompted to sign in with the same credentials you used to create your AdSense account. You’ll also be asked to confirm if you agree to grant the plugin access to your AdSense data. Once that’s done, your AdSense account information will be displayed on the page.

Your Google AdSense information will be displayed in the plugin's dashboard after you connect to AdSense.

Important note: tick the “Auto ads” checkbox to allow Advanced Ads to insert the AdSense header code in your website’s header. Doing so will enable you to verify your website.

You’ll also be asked to enable other settings by ticking relevant checkboxes. Once you do that, save your settings.

That’s it! You’ve connected your Google AdSense account to your WordPress site.

Whichever way you insert the code, you’ll have to verify with Google that the code has been properly placed. To do this, head over to your Adsense account and tick the checkbox to confirm that you’ve placed the snippet of code on your site.

Creating Google AdSense Units

An AdSense unit is a placeholder for the ads you’ll display on your website. You can create many ad units for a single web page, with each ad unit serving a specific type of ad. To create an AdSense ad unit, log in to your AdSense account and click on the “By ad unit”:

Once you know how to add Google Adsense to a WordPress site, you can now start creating ad units.

Next, select the type of ads you want to display on your site. You have three options:

  • Display ads
  • In-feed ads
  • In-article ads

If you’re not sure which ad type to use, we recommend starting with display ads.

After clicking on your ad type, you’ll be asked to name your ad unit. This is just for internal purposes, specifically to help you manage many different ad units. 

After clicking on your ad type, you’ll be asked to name your ad unit.

Besides naming your ad unit, you’ll also have to choose your ad size. Responsive ads are the most recommended as they display well across different devices and screen sizes.

Next, click the “Create” button to continue.

AdSense will generate a unique ad code for you when you do this. This contains the ad unit ID and your publisher ID.

When you create an ad unit, AdSense will generate a unique ad code for you.

You’ll use this code to place your ad units on your site.

Placing AdSense Ads on Your WordPress Site 

Once you have your AdSense ad code, you need to determine where to place the ad. In most cases, the sidebar would be your best bet. To place your ad, you’ll need to use WordPress’s widgets. You’ll find this under your WordPress dashboard’s “Appearance” section.

You can place your ads in appropriate places by using widgets.

Once you open the widgets tab, drag and drop the “Custom HTML” widget to the widget area you want to place your ad unit. Next, paste your Google AdSense code in there. However, for better ad placement control and tracking, we recommend you use a plugin like AdSanity.

Adding Auto-Ads AdSense Code in WordPress

Manually placing individual ads on different places of your site is a very time-consuming process. For a beginner, it can be a very challenging task.

Google introduced auto-ads to solve this very problem. The auto-ads feature allows you to add one snippet of code to your site and let Google AdSense determine the best location, ad size, and ad type for your site. The only caveat of this method is you have less control over the process.

To leverage the auto-ads feature, sign in to your Google AdSense account and click on the “Ads” tab. Next, click on “Get Code” to generate a code for your auto-ads.

To place auto-ads, you need to generate a codecode from the Ads section of your AdSense account.

As before, copy the code.

The auto-ads function uses the same snippet of code to generate ads everywhere on your WordPress site. You need to add the auto-ads code to every page you want ads to be displayed for this to work.

The easiest way you can do that is to paste the code into your theme’s header.php file. However, this is not the best solution, as the code will be erased every time you update your theme.

The best way to add the auto-ads code to your website is by using the Insert Header and Footers plugin as before.

Once inserted, the plugin will add the code to every page on your website. Google AdSense will then automatically display ads on your site.

Now You Know How to Add Google AdSense to a WordPress Site: Go Ahead and Make Some Ad Money! 

Now that you’ve connected Google AdSense to your WordPress site, the money will come rolling in, right?

Well, not quite.

Ads will only make you money if you drive relevant traffic to them. The two best ways to do that are creating high-quality content and leveraging SEO best practices

We can help you with both.

While we don’t create content, our plugin can help ensure that your content follows readability and SEO best practices. However, our forte lies in SEO. With the AISEO plugin, you can optimize your content and website for search engines and users.

AIOSEO is an easy-to-use, no-code SEO toolkit used by over 3 million users. You can use it for on-page SEO and technical SEO, thereby increasing the chances of your content and ads being seen by the right people. 

That’s why, if you haven’t, you should download AIOSEO today. It’s an essential tool for every online marketer.

Want to Try AIOSEO for Free?

Enter the URL of your WordPress website to install AIOSEO Lite.

Please enable JavaScript in your browser to complete this form.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.

author avatar
Kato Nkhoma Content Writer
Kato is one of those rare unicorns born with a pen in his hand—so the legend says. He’s authored 2 books and produced content for hundreds of brands. When he’s not creating content for AIOSEO, you’ll find him either watching tech videos on YouTube or playing with his kids. And if you can’t find him, he’s probably gone camping.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

15 comments on “How to Add Google AdSense to a WordPress Site

  1. Hi, Thank you so much I am a learner and this is my begging journey, this is helpful for me – But I can’t understand how to link with BING as per shown in the helping picture , if you guide me I will be very thankful, as I told you before I am a writer and don’t know about SEO or technicalities. I am like just a student and learning through your help. In the future, I decide my relationship with AIOSEO continue. so right now I am trying to configure or set up AIOSEO.

    Best regard and thank you
    Muhammad Shahid Mahmood

  2. I applied google adsense but unfortunately 2times google adsense rejected, there said low value content. Now want I want to do, can you help me? Please.

    1. Hi Arun,

      I think you should follow the recommendation and invest in improving your content quality. It may mean spending more time on resources, but in the end it will pay off.

      Here’s to your success.

  3. I really learnt a lot,but I just want to ask if I don’t get AIOSEO but I have AdSense account my site won’t make money right?

    1. Hi Steven,

      AIOSEO helps you improve your SEO so your content ranks higher. The better your content ranks, the more money you can make from your website. If you haven’t yet, try out the free version of AIOSEO.

      Thanks for your comment.

  4. Hi, I have different question

    Can I scroll my website for checking
    if there is adsense ads or it will cause invalid activity? If so. how can I check? my website?

  5. Hello there,Before anything else I want you to know that I am not so good in written nor speak in English.But I try my best then I understand a little bit.the things that you introduce us its look good and essential for a new one like me.Can you give me more advice or any suggestion. Thank you and more power.

    1. Thank you, Eduardo. Glad you found the post helpful. Keep following the blog and you’re bound to learn a ton of SEO and digital marketing strategies.

  6. Google Adsense code is shown to slow page loading speed. Can the code loaded into the footer rather than the header? Or is there another way to have a page load before Adsense tries to load?

    1. Hey Richard, Thank you for this. It is possible to add the code for auto ads in your footer but you need to know what you’re doing. We suggest using lazy loading, asynchronous loading and other optimizations.