How to Add Google AdSense To Your WordPress Sidebar in 3 Minutes

Updated by Talia Moreno on February 26, 2024


Google AdSense is one of the best ways to manage ads on your website. If you’re starting out, Read Why Google AdSense might be the right choice for you.

In addition to that, if you’re thinking of adding Google AdSense to your website as a complete beginner, I’d always advise you to go with something that will make you learn the ways of how WordPress works through the way.

Now, let’s add Google AdSense to WordPress.

Add Google AdSense to WordPress Sidebar

Adding Google AdSense to WordPress’ Sidebar is very easy. In fact, one of the easiest ways of adding the AdSense Code to your website without making your site heavy with many plugins.

Go to Appearance -> Widgets

You’ll see that there is a default sidebar created from your theme. You can use that or create a new one to suit your needs.

Now, on the left side you will see the ‘available widgets’ section. Search for ‘Custom HTML’ widget here.

Drag and Drop the Custom HTML widget to your Default Sidebar/Sidebar of your preference.

Now, go to Google AdSense and click on Ads on the left side. Go to ‘Ad Units’.

Here, create a new ad unit. You can refer to this tutorial to Create a Google AdSense ad unit. You’ll get a code known as the ‘Ad Code’ on your screen now.

The Google AdSense Ad Code will look something like this:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- sidebar_main -->
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:250px"
     data-ad-client="client id will be here"
     data-ad-slot="ad slot id will be here"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<! Don't get confused by this code! You just have to copy and paste the code you get from Google AdSense to the Custom HTML Widget on your WordPress Sidebar
--!>

Copy this code and paste it in your Custom HTML Widget.

Save and you’re done!

Note: Ads might take some time to load after you have created them just now in Google AdSense, so please wait for a while before you can start seeing those ads on your website. 🙂