PHP Magic Book – Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

Remove Ads for Registered Users or Admin on WordPress Blog

While applying modifications online at your WordPress blog sometimes you have to re-re-refresh the blog to view quick changes. Well! you are running a blog, so you have Adsense or other Ads code too. You do not want to get banned from adevrtising companies. Right?

While you are modifying the code, so you will be logged in. We can hide the code when admin user is still in session or when he is logged in, code will not be displayed.

We just have to use the is_user_logged_in() function, which returns true if an user is logged in.

Just paste the following code anywhere on your theme where you display ads.

if (!is_user_logged_in()) {
// Insert Adsense (or whatever) code here
}
  • Share/Bookmark
Tags: ,
Posted in: Hacks, WordPress
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts




One Response to “Remove Ads for Registered Users or Admin on WordPress Blog”

  1. Sep 30, 2009
    katherine Says:

    Hey very nice blog!!….I’m an instant fan, I have bookmarked you and I’ll be checking back on a regular….See ya

Post a Comment

  Subscribe Via RSS
  Subscribe Via Email