diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index eb8f0a13aa..3414da0fbc 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -95,10 +95,6 @@ function wp_signon( $credentials = array(), $secure_cookie = '' ) { $user = wp_authenticate( $credentials['user_login'], $credentials['user_password'] ); if ( is_wp_error( $user ) ) { - if ( $user->get_error_codes() == array( 'empty_username', 'empty_password' ) ) { - $user = new WP_Error( '', '' ); - } - return $user; } diff --git a/src/wp-login.php b/src/wp-login.php index 72fcae266d..b02a2b9e70 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -1007,6 +1007,10 @@ switch ( $action ) { $errors = new WP_Error(); } + if ( empty( $_POST ) && $errors->get_error_codes() === array( 'empty_username', 'empty_password' ) ) { + $errors = new WP_Error( '', '' ); + } + if ( $interim_login ) { if ( ! $errors->has_errors() ) { $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' );