WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to be able to hide a widget in the front-end if the user is logged in and only display the widget when the user is not logged in.

I have found a plugin that does this called Widget Logic however i don't want to install too many plugins especially for something as small as this.

Your help will be much appreciated.

share|improve this question
up vote 1 down vote accepted

If you're comfortable changing the code where the widget is outputted you could use the is_user_logged_in() function. Something like this:

<div id="widget_area">
        if ( is_user_logged_in() ) {
            // show nothing
        } else {

The downside being that this is now hard coded and you might have to add this function in a few different files.


share|improve this answer
That worked great, thanks alot @Steve – Loxzibit Aug 29 '12 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.