From 81a54a49d4e3e32a91c23b19cbb408c138bd02ab Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Dec 2019 15:34:49 +0000 Subject: [PATCH] Login/Registration: Pass the error data to the `wp_login_failed` action. Props hamedmoodi, rixeo. Fixes #49007. git-svn-id: https://develop.svn.wordpress.org/trunk@46971 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 5edef2d0c5..aa632921c6 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -547,15 +547,19 @@ if ( ! function_exists( 'wp_authenticate' ) ) : $ignore_codes = array( 'empty_username', 'empty_password' ); if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) { + $error = $user; + /** * Fires after a user login has failed. * * @since 2.5.0 * @since 4.5.0 The value of `$username` can now be an email address. + * @since 5.4.0 The `$error` parameter was added. * - * @param string $username Username or email address. + * @param string $username Username or email address. + * @param WP_Error $error A WP_Error object with the authentication failure details. */ - do_action( 'wp_login_failed', $username ); + do_action( 'wp_login_failed', $username, $error ); } return $user;