• Resolved simalamdeveloper

    (@simalamdeveloper)


    Hello

    I am looking to hide the WordPress login page, and create a custom page to log in and log out.

    I currently have a page that allows the user to log in, and one that allows them to log out.

    The problem is when they type in a wrong password they are redirected to the WordPress standard login page and not my own custom one.

    Does anyone know how to solve this problem?

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

    Thread Starter simalamdeveloper

    (@simalamdeveloper)

    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 ‘Custom login page redirects to standard login page on incorrect password’ is closed to new replies.