DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

On the WordPress codex, bb5999 asked how he can remove ads for logged in users. Here’s a very easy way to hide ads to registered users.

Hiding ads for registered users is a good idea since it can help you to decrease the risk of being smart-priced by Adsense.
To achieve this, we just have to use the is_user_logged_in() function, which returns true is an user is logged in.
This recipe is very easy to use, just paste the following code anywhere on your theme.

if (!is_user_logged_in()) {
// Insert Adsense (or whatever) code here
}

Leave a Comment

Your email address will not be published. Required fields are marked *