Add Adsense To WordPress Post

There are few ways to add Adsense to the wordpress. The easier way is to use the plugin like Insert Post Ads. However, adding too many plugins will increase the loading time of for your blog. Hence, I prefer to insert the Adsense code into the php files to reduce the risk of overloading the blog.

One way of insert Adsense into post content is to edit the function.php and insert the following code at the end of the php

Function myAdSenseCodeFunction(){

Return ‘Insert you Adsense Code Here’;


Add_shortcode(‘AdsHere’, ‘myAdSenseCodeFunction’);

Insert you Adsense Code Here is where you copy the Adsense code from google and paste it into red highlighted text.

When you are writing your post, you can just put the Adsense in anywhere you like in the content of the post by putting this short code into the post; [AdsHere]

For example,

Adsense Example

The post will looks like this:

Adsense Output

In this way, you can have more control on post ads rather than just fix at one location.