• I’m trying to get a widget to only appear to logged in users.

    I’ve installed Widget Logic Plugin and followed instructions on a post I found that says that all you need do is insert this code into the Widget Logic field:

    is_user_logged_in() .

    I’ve done this, but when I log in the widget in question isn’t visible.

    Can anyone tell me what I’ve done wrong please?

Viewing 1 replies (of 1 total)
  • Adrian

    (@adrianfraguela)

    You need to have an if statement when using is_user_logged_in()

    From WordPress Codex:

    <?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to use "is_user_logged_in() ."’ is closed to new replies.