How To Hide Widgets For Logged In WordPress Users

While working on the backend for a membership site we are launching later this year, we wanted to find a way with WordPress to hide widgets for logged in wordpress users, and vice-verse.

After several Google searches, I found the solution.

The plugin you need is (drum roll please……):

Widget Logic (click for link to plugin download)

Once you have downloaded and activated the plugin, you’ll notice a new input text field has shown up when you look at the widgets you have active in your blog:

The widget logic text field is what allows you to tell WordPress when, or where to show this widget. In this case, we don’t want to show the Facebook like box to our logged in members, but we do want to show it to our blog visitors. By inserting the !is_user_logged_in() conditional tag, we are telling wordpress to show this when the user is not (the ! is the opposite of the conditional tag) logged in.

I hope this helps anyone with membership sites out there control what widgets show up for their logged in members. If you have other solutions you’ve used on your membership site, please hit up the comments below and let me know.

Related posts:

  1. How To Auto Tweet Your New Blog Posts
  2. W3 Total Cache Cut My WordPress Blog Load Time in Half
  3. How To Add The ReTweet and Facebook Share Buttons to Your Blog
Darryl is a HealthCare IT professional by day, and a real estate investor and internet marketer by night. Darryl writes about technology and real estate.
  • JonC

    Great article!

    Thanks for pointing this out. I’ve been looking for a simple way for a widget to display a ‘register below to receive x’ message but obviously hide when users are logged in! This is perfect….

    • http://darrylkraemer.com/ Darryl Kraemer

      Thanks JonC! Glad it helped you.

  • MrGoodNews

    Finally found a way not to affect statistics counter while checking my website. Thank you! :)

    • http://darrylkraemer.com/ Darryl Kraemer

      No problem. Glad to help!