WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Forward Users Directly to Site After Login (4 posts)

  1. Tom Lany
    Member
    Posted 8 years ago #

    I would like to have the ability to forward users (especially subscribers) dirrectly to my blog home page after login. I am sure that some of the subscibers want to simply view the site, and seeing a dashboard may confuse them.

    I appologize if a thread on this topic has already been created. I could not find one. Thank you in advance for your assistance.

  2. impelus
    Member
    Posted 8 years ago #

    I just did this myself because I was annoyed with having to explain to people how to view the site and it was taking too many steps. There might be a plugin or some easier way to do this, but I simply edited the wp-login.php (the login screen).

    The wp-login.php is located in the base directory of your WordPress installation.

    Look for the $redirect_to tags. There are several in there for different reasons, but the part of code I changed was.

    $user_login = '';
    $user_pass = '';
    $using_cookie = false;
    if ( !isset( $_REQUEST['redirect_to'] ) )

    $redirect_to = '/wp-admin';
    else
    $redirect_to = $_REQUEST['redirect_to'];
    $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $redirect_to);

    change the /wp-admin to just /

  3. impelus
    Member
    Posted 8 years ago #

  4. Tom Lany
    Member
    Posted 8 years ago #

    Thanks everyone!! I got it to work.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags