Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Properly Add Google AdSense to Your WordPress Site

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add Google AdSense to your WordPress website?

Google AdSense is one of the easiest ways to start making money online with your website. It allows you to automatically sell your website’s ad space to advertisers and get paid.

In this article, we will show you how to add Google AdSense in WordPress, along with some best practices and tips to increase your earnings.

How to Add Google AdSense to WordPress site

What is Google AdSense?

Google AdSense is an advertising network run by Google that allows bloggers and website owners an opportunity to earn money by showing text, images, videos, and other interactive advertisements on their websites. These ads are targeted by site content and audience, so they’re highly relevant.

Google AdSense is hassle-free because you don’t have to deal with advertisers or worry about collecting money. Google administers and maintains relationships with advertisers. They collect the payment, take their management fee, and send the rest of the money to you.

AdSense offers cost-per-click ads (CPC), which means that you earn money every time a user clicks on an ad on your website. The amount received per click varies based on a variety of factors.

Getting Started with AdSense

The first thing you need to do is sign up for a Google AdSense account. If you have a Gmail account, then you can use your existing account to sign up.

Once you’ve submitted your application, you will need to wait for the Google AdSense team to review it. This may take a few hours to a few weeks for some publishers.

Once it is approved, then you can log in to your AdSense account and get your ad code. This is the code that you need to place on your WordPress website to display ads.

With Google AdSense auto ads, you can paste just one piece of code and then Google automatically decides when, where, and how many ads to show on each page.

However, many publishers use the manual method to individually place ads on their websites.

We’ll show you both methods. We recommend starting with the manual ad placement first. Once you have started earning, then you can experiment with auto-ads to compare them yourself.

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, just keep reading.

1. Manually Place Google AdSense Ad Code in WordPress

You’ll start by clicking on the Ads menu in the left column and then switching to the ‘By ad unit’ tab. From here, you need to click on ‘Create New Ad.’

You will be asked to choose an ad type. You can select from Display ads, In-feed ads, and In-article ads.

If you are unsure, then start with the display ads.

Choose your unit

Next, you need to provide a name for this ad unit and select the ad size and type.

Enter details and select size

The name of the Ad is only used for internal purposes so you can name it anything like “SiteName Sidebar.”

The next option is choosing the Ad Size. While Google offers a wide variety of ad sizes, there are certain sizes that are listed under recommended because those are the most popular among advertisers. See our guide on the best Google AdSense banner sizes for more details.

You can also choose whether you want your ad to be responsive or fixed. We recommend choosing responsive ads as they work well on all devices and screen sizes.

Next, click on the ‘Create’ button to continue.

AdSense will now generate the ad code for you. It contains the unique ad unit ID and your publisher ID.

Copy the code

Simply copy your ad code and paste it into a plain text editor like Notepad or TextEdit. You will need it in the next step.

Adding Google AdSense in WordPress

Next, you need to determine where you want to show the ad on your website. Ads are most commonly displayed in the sidebar. You can add Google Adsense to your sidebar by using WordPress widgets.

Simply go to the Appearance » Widgets page in your WordPress admin area. Next, click the ‘+’ button to add a ‘Custom HTML’ widget block to the appropriate widget area.

Add custom HTML widget block

Next, you’ll need to enter the Google AdSense code in the Custom HTML widget block.

After that, don’t forget to click the ‘Update’ button.

Enter code and update widgets page

For better placement control and tracking, we recommend checking out a WordPress plugin like Advanced Ads or AdSanity.

You can see our guide on the best ad management WordPress solutions for more details.

2. Add Auto-Ads AdSense Code in WordPress

Adding individual ads to different areas of your website takes a lot of time. Most beginners struggle to find the best locations to display ads on their sites.

To solve this, Google introduced auto-ads. This allows you to simply add one code snippet to your site and let Google AdSense figure out the highest paying location, ad size, and type.

The disadvantage of this method is that you have less control over ad placement on your website.

If you want to use the auto-ads feature, then this is how you’ll add Google AdSense to your website.

First, log in to your Google AdSense account and click on the Ads tab. Next, you need to click on the ‘Get Code’ button to generate the auto-ads code.

Get code for auto placement

AdSense will now generate a code snippet with your publisher ID and display it. You can now copy and paste this code into a text editor.

Copy and paste the code

Adding AdSense Auto-Ads Code in WordPress

The auto-ads code uses a single code snippet to generate ads everywhere on your WordPress blog. This means you need to add the code to all the pages where you want to display the ad.

One way to do this is by adding the code to your WordPress theme’s header.php file. However, the disadvantage of this method is that your ad code will disappear if you update or change your theme.

The best way to add any site-wide code to your website is by using a plugin like WPCode.


WPCode makes it safe and easy to add header and footer code in WordPress, without editing your theme files. This means that you’ll be able to save your ad code even if your theme changes.

First, you need to install and activate the free WPCode plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Note: The free version of WPCode has everything you need to add custom code snippets to your site. However, if you want advanced features like conversion pixels, scheduled snippets, code revisions, and more, you can upgrade to WPCode Pro.

Upon activation, go to the Code Snippets » Header & Footer page. From here, you need to paste your Google AdSense code in the header section.

Paste Google Adsense code in the header using WPCode

Don’t forget to click on the ‘Save Changes’ button to store your changes.

The plugin will now add the ad code on all pages of your website. It may take Google AdSense some time to start showing ads.

Related: See our guide on how to add header and footer code in WordPress for more details.

You can also use the WPCode plugin to automatically display Google AdSense ads in specific areas like before the beginning of a post, after a post, before or after a paragraph, and more.

For step by step instructions, see this guide on how to insert ads within your post content in WordPress.

AdSense Best Practices and Frequently Asked Questions

Over the years, we’ve answered several AdSense-related questions. Having used AdSense on several of our sites in the past, we’ve learned a whole lot about optimizing. Below are some AdSense best practices and frequently asked questions.

What’s the best AdSense Ad Size?

Although ad placement is key, we’ve found that the best sizes are 336×280 and 300×250. These ads tend to fit on most screen sizes and have the best pay rate as well.

What’s the Best AdSense Placement?

This entirely depends on your layout. The goal is to get more impressions and clicks, so you want to place your ads in a more prominent spot. We have found that ads within post content toward the top of the screen tend to get the most clicks.

Several users have asked us about adding AdSense in a floating widget because it will be very prominent. We strongly recommend against that because it is not allowed by Google Terms of Service. If you violate their TOS, then you can get banned from the program.

Can I click on my own Google AdSense Ads?

Often beginners are tempted to click on their own ads or ask their family members to click on their ads. Please don’t do that. Google’s algorithm is very smart and knows when you’re clicking on your own ad. This can get you banned from the program.

To learn more, see our guide on how to prevent invalid AdSense clicks in WordPress.

What is Page RPM in Google AdSense?

RPM stands for Revenue per Mille, meaning revenue per 1000 impressions. This is determined by multiplying the total number of clicks and cost per click and then dividing that by the total number of pageviews.

Can I use my Blogger or YouTube AdSense account with WordPress?

Yes, you can. If you started using AdSense on one of Google’s hosted platforms like Blogger or YouTube, then you can change your AdSense account type and use it with WordPress. You’ll need to provide Google AdSense with the URL of the site you want to monetize by filling out an application form.

Simply log in to your AdSense account and then under ‘My Ads’ click on the ‘Other Products’ option. Next, you need to click ‘Upgrade now’ and complete the application form.

What is CTR in Google AdSense?

CTR or click-through rates differ vastly for different kinds of websites. Your ad clicks depend on a lot of factors, like your website’s topics, your audience type, ad placement on your site, and more. The ideal CTR for Google AdSense is really hard to define because you don’t have access to the click rates of other websites like your own.

However, Google AdSense has built-in tools that will start showing you messages if your site is not getting a good CTR. You can follow the optimization guides shown inside the Google AdSense dashboard to improve your ad revenue.

You may also want to see our guide on how to set up Google Ads conversion tracking in WordPress.

When and how does Google AdSense pay publishers?

Each month, Google AdSense calculates your previous month’s earnings and shows them on your ‘Transactions’ page. If your earnings match the required threshold, then your payment is processed and released by the 21st of that month.

There are multiple payment methods available, including direct electronic transfer, wire transfer, check, Western Union, and more.

Why did Google AdSense reject my application?

Google Adsense may reject your application if your website is brand-new or otherwise doesn’t meet the AdSense program policies or their terms and conditions.

If they do, you could always consider using another ad management plugin or try another way to make money with your WordPress site.

What are the requirements to get Google AdSense application approved?

Here are the minimum requirements to get your Google AdSense account application approved.

  • Your website and all its content must comply with AdSense program policies and terms and conditions.
  • Your website should be at least 6 months old.
  • You, the applicant, must be over 18 years old.

Note: Even if your application meets all the requirements, Google AdSense still reserves the right to decline your application.

Can I add Google AdSense in my blog? does not allow you to add Google AdSense to your website unless you upgrade to the Business plan. For more on this topic, please see our guide on the difference between vs

What is the difference between Google AdSense vs Google AdWords?

Google AdWords allows you to advertise on other websites, including those participating in the Google AdSense program.

Google AdSense allows you to make money from your website by showing ads on your website.

How do I get rid of Adsense Ads?

If Google Adsense is displaying too many ads or you’re seeing ads in random places on your site, you’re probably using Google Adsense Auto ads.

To turn off Auto ads, sign in to your Adsense account and go to Ads » Overview. Next, click on the ‘Edit’ icon next to your website. You can disable the Auto ads options in ‘Site Settings’ to completely remove Auto ads on your site. Or, you can select the ‘Page Exclusions’ option to disable Auto ads from specific pages.

We hope this article helped you add Google AdSense to your WordPress site. You may also want to check out our guide on how to increase your blog traffic, and the best email marketing services to grow your subscribers.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

461 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. William says

    Hi WPbeginer,
    My Adsense is loaded on my webiste but it show as blank space. I inspect my Firefox browser and it showed that I have my ads code but it doesn’t show images. I check and confirm that my webiste is not baned by Google Adsense. Please advise.

    • WPBeginner Support says

      Adsense may not have an ad they would recommend for your site at that time. If you feel that there may be an error with the code you can check using the Google Adsense Troubleshooter to ensure the ad is set up correctly


  3. bidaqiqa says

    Thank you so much, your article helped me properly setup Adsense on my site that was very helpful guys. Thanks again :)

  4. Raakesh V says

    Thank you so much for your wonderful article. Today is a really unforgettable day for me. I get approved for my blog. It’s because of you only. Love you thanks for guiding me. I’m a new AdSense publisher now,

  5. Amy says

    Thank you. This was helpful. My ads disappeared with the latest ads.txt update and I had been having trouble getting them to show up again. With the help of this article I was able to ad a widget and I can collect my pennies from adsense again. :-)

  6. Amanda says

    How would I add code in between post paragraphs (beyond the sidebar)?

    I don’t want to clutter my sidebar because I already have a couple ads there. Thanks!

  7. Migdalis says

    Another great article. I’m a new blogger and I found all I needed to know to help me through the entire process right here on your page. God Bless you! Thank you for sharing your knowledge.

  8. Shekhar Chugh says

    Well, I need some more help…
    I am unable to activate Google Adsense for my website
    Can You help me???

    • WPBeginner Support says

      It would depend on the reason why your Adsense is not activating. You should receive an email or a message in your dashboard for why Adsens is not activating.


  9. Dilber says

    i am trying to add adsense ad code in my header but it shows error 500, I tried both the method manual and by plugin but it shows the same, i already tried changing theme but it also doesn’t work , what to do know please help?

  10. Franklyn Fosu says

    Thanks a lot for this post.
    I have tried several times to save my AdSense verification code after pasting it in the header.php and ads widget but it doesn’t save. Tried so many times. It just keeps loading and never saves.
    Need your support to fix this issue because it’s been so many months I’ve struggled with this issue.
    Thank you and hope to hear from you soon.

  11. RAhul Kedia says

    I have submitted my website three times on Google Adsense but my Adsense has been disapproved and the reasons are your Url is a typo.

    What is the typo URL?
    How can I solve it?

    Help, Thank you

    • WPBeginner Support says

      You may want to ensure there isn’t another error message with that, otherwise, you would want to reach out to Adsense’s support for assistance.


  12. Nabeel Arif says

    sir on my blog are not showing any single ad i’m facing this problem last 2 days.
    sir i’m confessed because when i open blog on Mobile where all ads are showing. But not showing on PC.
    Please help me how can i remove this problem

    • WPBeginner Support says

      You would need to reach out to Adsense for the specifics, more than likely there aren’t ads for the size you’re using as a possibility.


  13. jessica says

    I have tried to use my adsense code but I can not add it in my widget and it will not work. The main error I get is “tag is not allowed.”

  14. Fanni says

    I tried to add my custom adsense html code to my side bar but it told me that is not allowed! What should I do? Do you have any solution for this?

  15. Sanaullah farooq says

    Hi sir, after WordPress update, I am not able to save this custom HTML Widget, when I add Adsense code the HTML Box taking a lot of time and not saving.

  16. Sonya says

    I’m looking to “upgrade” because I’ve switched from blogger to WP, but I can’t find the tabs following your instructions:
    “Can I use my Blogger or YouTube AdSense account with WordPress?”
    I don’t have “My Ads” and when I go under “Ads >> Other Products” I don’t have an upgrade options, it just gives me the option to monetize games and videos.
    What do I do?

    • WPBeginner Support says

      Sadly, with how often Google changes their methods, you would want to reach out to the adsense support to the current method


  17. rita says

    Thank you for the article! I need some help – I have added the header and footer scripts plugin to my site and copied and pasted the adsense code in the header area per instructions. However, I haven’t gotten approval still. Adsense recommends placing the code on each page I want ads to show up but isn’t that what the plugin is doing?

    • WPBeginner Support says

      The plugin does add the code to each post and page. It can take time for Google Adsense to approve your site depending on your content.


  18. John says

    Thanks for a great post.
    We currently use the AdRotate plugin on our WordPress site and this fulfills a need that we have for advertisers who book directly with us. If we use AdSense, will we still be able to place ads for clients/advertisers who book directly with us?

    • WPBeginner Support says

      For that, you would need to check Adsense’s ad placement policy for their limitations.


  19. Heidi says

    Hi, thanks for the article. One question: do I need to add multiple HTML widgets if I want a couple of ads in my sidebar? Or can I put all the HTML code for the ads within one widget? Thanks so much if you can help!

    • WPBeginner Support says

      That is a question of personal preference but you can use either option for multiple ads.


  20. Maya says

    Thank you so much for sharing this very valuable information with the world. As a beginner it really is helpful. I have 2 questions that I really need help with:

    1. How do I hide certain ads from showing in a certain location?
    2. I happened to be approved by Thrive Market affiliate, will that be a problem with Google Adsense?

    Thank you so much in advance for your time and advice!
    Best Regards,

    • WPBeginner Support says

      For Adsense, you would want to set up their auto ads for excluding ads appearing from certain pages. For multiple ad programs you would need to check the current policies of the ad networks you’re using or wanting to use.


  21. Pritishb says

    So my question is I have my wordpress blog since 2013 but since then I didn’t really used it for a couple of years. Now Im ready to use it so I cleared all the oldest articles of the past. So would they consider my blog as a new one ? Since you mentionned only website with minimum 6 months will be allow for google ads. Please help me.

  22. Shams Ali says


    I have fully approved adsense account on my blogger blog. I just migrate my blogger blog to WordPress, now the question is, is it ok to place the ad codes on my new WordPress site, or I should add the url to adsense url list etc? Thanks

    Shams Ali

    • WPBeginner Support says

      You should be able to maintain your ads on your WordPress site if it is the same URL, otherwise, you would need to add the new domain to your Adsense for it to work properly.


  23. Tracey says

    Thank you, I really needed this article because it was really helpful.
    Just wondering if you would help me with something? I have -Google Adsense- above the ad in my sidebar and have no idea how to remove it!

    Thank you for your time.


    • WPBeginner Support says

      You may want to check the title of the widget in case that is the cause of the issue :)


  24. Nisha Patel says


    Nice article. I just wanna one help, should I give title like ‘advertisement’ or ‘ad’ to my Adsense ads on my site? even, is it compulsory? (if i do so, it will show on the top of the ad.

    Please help,


  25. Harsh Kumar says

    Sir can we still use Google Add-Sense in WordPress…..or is the plugin support ended as of 2019?……plz reply……..thank you

  26. prashant says


    just want to know can non-developer people add the code which you have provided?


    • WPBeginner Support says

      You would copy and paste the code given to you by Google Adsense using the steps provided in our article :)


  27. Lori says

    Google adsense is telling me to first past code into the HTML between the head tags. All the adsense instructional videos and websites do not explain how to do this first step, which is required to complete the activation of my account. It did not work using an adsense plugin and I’m not experienced enough to mess with code on my WordPress theme…..Is this a new step they are requiring? It’s confusing.

  28. Debi says

    Hello. I am at the point where I cut and pasted the Code. I hit save but there is no “Done” button. How would one resolve that?

  29. At9aija says

    Hello guru boss,
    Please i have a blog and i meet to have a google AdSense account, so i have a blogspot blog also, my question is that can i use my wordpress AdSense to my blogspot blog?

    Thank you

    • WPBeginner Support says

      If you follow the Adsense guidelines on both sites, Google currently allows you to use the ads on both.


  30. Aniekan Etop says

    hi there I’m Aniekan by name.
    please will the same procedure work with an Adsense alternative like Adsterra?
    because at the moment I’m unable to access my Adsense account/gmail due to the fact that my google account’s only recognised device got spoilt and right now, I’m unable to get 2 step verification backup codes to log into my account with a device other than the recognised one that has spoiled

    • WPBeginner Support says

      It would depend on how the service wants you to verify for if it would work or not. If you reach out to the service’s support they should have recommendations you can use.


  31. Jeff Norris says

    Do these same instructions apply to ads I am supplying through my Google Ads Manager?

    I work for a newspaper and we sell our own ads and manage with DFP (or what used to be).

    • WPBeginner Support says

      It is a similar process but for specifics, depending on what you’re wanting, you would want to take a look at Google’s documentation for their Ad Manager.


  32. Kene Nwabuzors says

    Thanks admin, i followed each of your steps here and i got AdSense approval for my blog

    Now, i have been hearing alot of people complaining about AdSense banned issue, hope am save?

    • WPBeginner Support says

      As long as your content does not break Adsense’s policies you shouldn’t have to worry.


    • WPBeginner Support says

      If it was a specific error, Google normally should link you to their page about the policy you would need to comply with


  33. Luka says

    I applied to Google Adsense account and in that process I had to copy and paste the verification code in my header.
    I get approved and I want to set up automatic ads on my site.
    For that I need to copy and paste code in my head, but that code is the same code I copy and paste before for registration.
    So do I need to have two codes or just one. What should i do?
    My site is verified for 3 days and no ads appearing for now.

    • WPBeginner Support says

      If it is the same code then you shouldn’t need to add a second copy of the code to your header section.


  34. Ihsan says

    How to solve problem that adsense just show on live preview mode, when i open my web i cant saw it, thanks

  35. James says

    Please can you tell me what is the requirement, do’s and don’t of google adsense to be able to get one hitch free as beginner in blogging?

  36. Gandire says

    I had a wordpress webiste for about 2 years. I recently decided to switch that account over to a new domain and host. Does that count to the 6 month wait period?

Leave a Reply to WPBeginner Support Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.