Hello guys! Guys I want to disable plugin 'whydowork' adsense for non-admin so that whenever I post an article adsense ads should be displayed and whenever an author (non-amin) posts an article adsense ads should not displayed. Thanks!
I think the easiest way is to add a test function to the template. The plugin excludes ads when <!-no-adsense--> appears in the post. This line should add it to non-admin posts. I would place it after <?php the_content(); ?> <?php if (get_the_author_meta('user_level') != 10 ) echo '<!-no-adsense-->'; ?> Hope that works
On second thought, that probably won't work because it's outside the content and the plugin won't see it. Try adding this to functions.php instead /** * Adds comment to non-admin posts so that WhyNotWork plugin does not insert ads */ function add_adsense_comment($content = '') { if (get_the_author_meta('user_level') != 10 ) $content .= '<!-no-adsense-->'; return $content; } add_filter('the_content', 'add_adsense_comment'); Code (markup):