Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set up redirects based on logged-in/logged-out status

  • @cyndimarie

    Participant

    I have a handful of pages that I only want to be seen by users that are LOGGED OUT. If a logged in user somehow goes to one of these pages, I want to redirect them elsewhere:

    • Login Page
    • Registration Page

    And then there is a page that I only want to be seen by users that are LOGGED IN. If a logged out user somehow goes to one of these pages, I want to redirect them to the Login/Registration page:

    • Content Submission Page

    I’ve seen a couple different plugins, but none of them really give me the control that I want. In this forum post someone suggested adding code to functions.php but that did nothing for me.

    Any help would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @henrywright

    Moderator

    There is a hook you can use called template_redirect. And you can check if a member is logged in using is_user_logged_in()

    @cyndimarie

    Participant

    Thank you, that is perfect!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set up redirects based on logged-in/logged-out status’ is closed to new replies.
Skip to toolbar