[Paid Memberships Pro] AdSense isn’t loaded for people without membership?

Hi,

with the help from this thread: [https://www.reddit.com/r/Wordpress/comments/ywvzvz/comment/iwlrarv/?context=3](https://www.reddit.com/r/Wordpress/comments/ywvzvz/comment/iwlrarv/?context=3) i was able to create this code:

if ( function_exists( ‘pmpro_displayAds’ ) && pmpro_displayAds() ) {
echo ‘<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-xxx” crossorigin=”anonymous”></script>’;
}

But AdSense doesn’t load the Code when a user hasn’t a memberships, that is freed off in the PMPro Settings. My Admin Account has not the Ad-Free Membership, but AdSense is still not loaded. In the Source Code it doesn’t even referende.

I added the code above into the Code Snippets Plugin.

3 Comments
  1. Hi everybody! Found a way! Used PMPro’s [membership level] shortcode, added the code inbetween and selected to show it to everyone without a membership. Not the best, but hey, it works perfectly fine. 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer