add_action( 'wp_login_failed', 'pippin_login_fail' ); // hook failed login function pippin_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') ) { wp_redirect(home_url() . '/?login=failed' ); // let's append some information (login=failed) to the URL for the theme to use exit; } } add_action( 'wp_login_failed', 'pippin_login_fail' ); // hook failed login function pippin_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') ) { wp_redirect(home_url() . '/?login=failed' ); // let's append some information (login=failed) to the URL for the theme to use exit; } }
Skip to content