How to add adsense ads without using any plugins in wordpress

How to add adsense ads without using any plugins in wordpress

In case if you are are wondering how to add google adsense ad code in wordpress website without using any plugin, then this tutorial is definitely going to help you in your journey. Using this technique you can add google adsense ad code anywhere in your article/post with complete control without using any plugins.

First of all let us try to understand how a typical adsense ad code looks like, to have a proper knowledge of placing adsense ads you should know that how adsense ads look like.

For example:

<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXXX" crossorigin="anonymous"></script>
<!-- Name of the ad -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-XXXXXXXXXXX" data-ad-slot="XXXXXXXXX" data-ad-format="auto" data-full-width-responsive="true"></ins>
     (adsbygoogle = window.adsbygoogle || []).push({});

From the example given above you can understand that adsense ads are actually javascript codes, having the publisher id of the adsense account holder and also the data slot id (which is uniquely generated for every ad that you create in adsense). This javascript code can be easily implemented in a wordpress website. All you need to do is just copy the ad code of your adsense ad and place this code in custom HTML box in worpress post/page.

Suggested: How to Add an HTML Sitemap Page in WordPress

If still don’t understand how to place adsense ad code in wordpress HTML ad code box you can follow the steps given below to accomplish your task.

Placing adsense ad code

  1. Copy the ad code that you want to use from your adsense account.
  2. Login to wordpress.
  3. Select the post/page on which you want to place the ad code.
  4. In the visual editor click on “+” icon or type “/” from keyboard.
  5. Select custom HTML.
  6. Place the ad code in the custom HTML box.
  7. Click on update to save your changes.
  8. You can check the preview of your ad by selecting “preview” in the custom HTML box.

Still unable to figure out how to place the adsense ad code without using any plugins. Please watch the video below for your assistance.

Video Guide


Placing adsense ad codes like this very easy but do keep in mind if you usually change the ad code on your posts/pages then you have to copy and do this process to all the posts every time you want to use new ad codes. This process is not recommended for big websites having tens of thousands of posts.