WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Custom login page redirects to standard login page on incorrect password

[Resolved] Custom login page redirects to standard login page on incorrect password

Viewing 2 replies - 1 through 2 (of 2 total)
  • you can use wp_redirect() for this.

    Thanks PolshikovRM

    Based on your suggestion I was able to find something that worked for me! I had to edit it a little because it appended the failed login variable each time they attempted to login.

    add_action( 'wp_login_failed', 'my_front_end_login_fail' );  // hook failed login
    
    function my_front_end_login_fail( $username ) {
       $referrer = $_SERVER['HTTP_REFERER'];  // where did the post submission come from?
       // if there's a valid referrer, and it's not the default log-in screen
       if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
    
    	  $pos = strpos($referrer, '?login=failed');
    
    		if($pos === false) {
    		 	// add the failed
    		 	wp_redirect( $referrer . '?login=failed' );  // let's append some information (login=failed) to the URL for the theme to use
    		}
    		else {
    			// already has the failed don't appened it again
    			wp_redirect( $referrer );  // already appeneded redirect back
    		}	
    
          exit;
       }
    }

    Original Was found on:
    http://wordpress.stackexchange.com/questions/15633/how-can-i-redirect-user-after-entering-wrong-passowrd

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Custom login page redirects to standard login page on incorrect password’ is closed to new replies.
Skip to toolbar