• Dave

    (@deeve007)


    This has got me stumped.

    I’m using the following code in the functions file to redirect a front end login attempt if details are incorrect. It’s working perfectly on Firefox, but doesn’t seem to be working at all on any other browser. Anyone have any ideas??

    add_action( 'wp_login_failed', 'login_fail' );  // hook failed login
    function 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() . '/my-account?login=failed' );
              exit;
         }
    }
  • The topic ‘wp_login_failed only working on firefox’ is closed to new replies.