WP-Members: Membership Framework
[resolved] Redirect if ALREADY logged in (3 posts)

  1. BitBug
    Posted 2 years ago #

    First and foremost, thank you for a wonderful plugin. Very useful and very deep in its abilities.

    I'm using WordPress with WP-Members within a section of an existing website. I have the WordPress front page as a login page that uses the WP-Members short codes:

    [wp-members page="login"]
    [wp-members page="password"]

    I have used the WP-Members login filter and function redirect successfully for when someone logs in redirecting them to the Posts page.

    However, if someone is already logged in from a previous session and goes to the front page, the redirect does not recognize them as logged in and redirect them. I assume this might have to do with the filter and function not being called until someone logs in?

    My skills at coding are good, but I am relatively new to WordPress. Does anyone know how I can go about having WP-Members check if someone is already logged in, and if so redirect them?

    Assistance is greatly appreciated! Thanks!


  2. Chad Butler
    Plugin Author

    Posted 2 years ago #

    You can use is_user_logged_in for that.

  3. BitBug
    Posted 2 years ago #

    Thank you Chad, that led me down the right path.

    For those interested, the full solution was to put the following code in the header.php. I put mine right above the HTML5 declaration.

    if (is_user_logged_in() && is_front_page() ) {

    So the If statement checks if the user is logged in AND if they are on the front page of the site (which in this case is the login page for WP Members). If they are, then it redirects them to the page specified with my placeholder code of 'domain.com/pageToRedirectTo'

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic