Login redirect to referring page


I am certain this question has been asked before, but… :wink:

I have a network of sites, using domain mapping and multisite plugins. I would like to forward all login attempts, network wide, to a single login page on my base domain (for SSO purposes).

But after login, I would like users redirected back to the page they came from, wherever it was on the network.

Sure this has been done before. I’ve checked out a few plugins. Peter’s Login/Logout plugin in general repository, but I’m just uncertain what I should do.

Any help would be great :slight_smile:

  • Alexander
    • DEV MAN’s Mascot

    Hi Matthew,

    I actually couldn’t find a plugin for this, but here’s a quick code snippet I found that might help you: http://wpsnipp.com/index.php/functions-php/redirect-back-to-referring-page-after-login/

    But I’m pretty sure what you’re looking for is already built into WordPress. If you attempt to visit /wp-admin while not loggged in, it will take you to the wp-sigup page and prefill a referral link back to the dashboard you were trying to access.

    Regardless of site, they’ll always be heading through the same wp-login page.

    If you have domain mapping setup to map admin URLs to the original domain, this should will appear just like SSO.

    This way you can use the http://www.mainsite.com/wp-login.php page to handle logins for the entire network.

    Is there what you’re looking for? Or perhaps I’ve missed something and need to come back with another approach. Let me know your thoughts here.

    Take care

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.