wp login form wrong password redirect

Solutions on MaxInterview for wp login form wrong password redirect by the best coders in the world

showing results for - "wp login form wrong password redirect"
Mateo
11 Nov 2017
1//Add this to your plugin functions.php
2
3add_action( 'wp_login_failed', 'my_front_end_login_fail' );  // hook failed login
4
5function my_front_end_login_fail( $username ) {
6   $referrer = $_SERVER['HTTP_REFERER'];  // where did the post submission come from?
7   // if there's a valid referrer, and it's not the default log-in screen
8   if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
9      wp_redirect( $referrer . '?login=failed' );  // let's append some information (login=failed) to the URL for the theme to use
10      exit;
11   }
12}