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}