If you run a wordpress blog that has multiple contributors and would like to award contributors by sharing adsense earnings, read on.

Follow these simple steps

wordpress weekend
wordpress weekend

Step 1: Create an adsense channel for each author.

Step 2: Create ads (in adsense) and assign them under the specific author channel. Note the slot id for each ads.

Step 2: Add this code in your wordpress theme’s functions.php file (replace author1/author2 with author names, and slot id with author’s slot id)

function adsense_code($author) {
if($author == 'author1')
return '<slot id_author1>';
elseif ($author == 'author2')
return '
<slot id_author1>';
else // default author
return '
<slot id_admin>';

Step 3: Depending on where you want to showcase the ads, insert your adsense code (ensure that all the ad formats are same)

google_ad_client = "pub-id";
google_ad_slot = "< ?php echo adsense_code(get_the_author()); ?>";

Explanation/How this works?

What you have done is that

  • For each ad format, you assigned an ad slot to each of your authors.
  • Based on author’s slot id (which is picked up by the function), author’s ads will be shown on the site and earnings can easily be reported on the corresponding channel.
  • Note that author name in the function adsense_code is same as author’s display name (if you want, you can use author id as well).

Simple? Got questions? Leave them in the comment section.


Hello World.

NextBigWhat brings you well curated wisdom, news and actionable insights.

In a world where algorithms are deciding what you read (and learn), we bring a holistic view on product and growth – curated by the experts, enabling you to learn from the knowledgable sources and save time in discovering them.