Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to redirect all login and signup links to an external site.

I would prefer to do this in a plugin, or somewhere that isn't affected by WordPress upgrades or theme changes.

What is the best way?

Thanks!

share|improve this question
    
Are you thinking of something similar to OpenID? openid.net where credentials are kept external from your site? –  rexposadas Jan 11 '12 at 0:52
    
We are integrating WordPress with an existing system that has it's own user database. I've managed to get them to work together so that visiting WordPress from our other site will automatically login the user into WordPress. I need all the login and signup links in WordPress point to our other application's login and signup pages instead, though. –  getWeberForStackExchange Jan 11 '12 at 5:09

2 Answers 2

I have looked over the wordpress.org plugin directory and I couldn't find anything... but you can always do this:

1) Create a copy of the wp-login.php and name it to something secret so you can always login later (like superlog_in1234.php)

2) Edit wp-login.php and look for all the <form> elements, and replace them with <meta HTTP-EQUIV="REFRESH" content="0; url=http://website.com/">. Unless you know what you're doing, don't change anything else.

3) Head to /wp-admin AND /wp-login.php and test if it works!

You can always login over at your secret login page, and this what I use on my own website.

share|improve this answer
up vote 0 down vote accepted

I solved this problem by putting the code below into a plugin.

class My_Class {

    public static function go_to_login() {
        global $pagenow, $theme_my_login, $redirect_to;

        if ( 'wp-login.php' == $pagenow ) {
            $url = ( false === strpos( $redirect_to, 'wp-admin' ) ? $redirect_to : site_url() );
            wp_redirect( 'http://www.example.com/login?to=' . urlencode( $url ) );
            exit;
        }
    }

}

add_action( 'login_head', 'My_Class::go_to_login' );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.