How To Disable AdSense Ads To Logged In WordPress Users

If you are running AdSense Ads on a WordPress blog then you might wanna disable Advertisements for logged in WordPress users.

If ads are enabled to logged in WordPress users then the author might indirectly inflate ad impressions or he might click on a Ad by mistake.

This can be a serious issue since inflating ads or clicks is strictly against Google AdSense Policies. So its better to disable ads to logged in WordPress users.

Also if you target the advertisements only towards visitors instead of authors then it can dramatically increase the performance of ads on your website.

So in this post i will share how to disable AdSense ads to logged in WordPress users as well as how to disable ads on Post Preview Page.

#1) Disable Ads Only For Logged In Users

Include the following Code to display Adsense Ads. Just put the advertisement code inside the PHP conditions. So the AdSense advertisement will be only displayed to logged in WordPress users.

This will work in any .php file like Single Post file. But if you are placing an advertisement in Widget then this fails because the code is PHP.

If you want this to work in Widgets then you can use a plugin called ‘Executable PHP Widget’.

If you don’t want to use any plugin then check my post on how to execute PHP code in WordPress widget.

 #2) Disable Ads In Preview Mode

To disable advertisements in preview mode, you have to again use the same concept of PHP condition but slightly different code. This code simply checks if preview mode is on or not. If not then displays the advertisement.

And again since this is a PHP code, it won’t work in Widget unless you use a plugin or modify the functions of your theme.

2 thoughts on “How To Disable AdSense Ads To Logged In WordPress Users

Leave a Reply