You 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.







With the following plugin, http://wordpress.org/extend/plugins/dynamic-widgets/
you will have a full control on the who should see which widget.
Hope this helps
Fred
Thanks Fred. I put it up as an alternative to Widget logic.
Thanks for this bro, I’m new to wordpres and Im sure this would very helpful to me.
Not a problem. Also take a look at the other plugins if you’re new to WordPress.
what is the code for show only to guest users?
fantastic! I hunted high and low for this thanks so much! I don’t suppose you have any tips on only displaying category pages to logged in users – I can’t seem to nail the php for it
Hey! That’s brilliant, I have been looking for something like this for a while now. However, I need to do the opposite of what is being done.
I need to show a particular widget only to logged OUT users, any tips on how I could do that???
Indrashish Ghosh´s last blog post ..Why Your Business Is Missing Out By Not Optimizing For Search
Hi Indrashish, you can try !is_user_logged_in() to detect if the user is not logged in. Please let me know how it works.