Show WP Widgets to Logged On Users Only
Posted in Blogging, Plugins, Tutorials, WP Hacks on August 26th, 2010 by Icd – 2 CommentsYou can find various plugins that allow you to control on which pages you display your widgets. Unfortunately I was unable to find one specifically made to show certain widgets to logged on users only.
Fortunately I was able to figure out the next best thing, which is actually pretty basic. Just follow the steps below, it won’t take more than a minute.
1. Install the Widget Logic Plugin via your dashboard or download it here.
This plugin gives every widget an extra control field called “Widget logic” that lets you control the pages that the widget will appear on.
Now some of you might be thinking, “aah I have to fill something in… no thanks”. Don’t worry there’s only one more step and you only have to copy what I put down.
2. If you take a look at the above picture you will see the “Widget Logic” area which is situated on your widgets page at the end of each widget. Here you will have to add a conditional tag which tells WP to only show the widget to a logged on users.
Now all you have to do is add this tag : is_user_logged_in() .
Only add that tag to the widgets you want to display only to logged in users.
Alternative : Those who don’t need the advanced usage of Widget Logic can try the Dynamic Widgets Plugin , which will do the same and a bit more, without pasting any code. Thanks to Frederic for mentioning this.
Have fun. If you found this helped in some way, please make a comment.











