WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show something only to guests (3 posts)

  1. Visnes
    Member
    Posted 5 years ago #

    Is there any way to make something only show to people who aren't registered?

    I want to add a link to the registration page, but only have it show if the user isn't logged in. The below worked the other way around. :P Any similar function like that with "is_user_guest" or something?

  2. <?php if ( is_user_logged_in() ) { ?> Registrer deg! <?php } ?>
  3. Thanks for any help. :)

  • Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    if ( ! is_user_logged_in() ) {
    ...
    }

    The ! means "not" in PHP.

  • Visnes
    Member
    Posted 5 years ago #

    Thank you very much. :) Worked like a charm. ^^

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags