From d273235abd1ead542bd8a2908ad065c368ff8de9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Dec 2019 15:36:01 +0000 Subject: [PATCH] Login/Registration: Pass the error data to the `wp_login_failed` action. Props hamedmoodi, rixeo. Fixes #49007. Built from https://develop.svn.wordpress.org/trunk@46971 git-svn-id: http://core.svn.wordpress.org/trunk@46771 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 5edef2d0c5..aa632921c6 100644 --- a/wp-includes/pluggable.php +++ b/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; diff --git a/wp-includes/version.php b/wp-includes/version.php index 1068044332..a14ba3c7ce 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46970'; +$wp_version = '5.4-alpha-46971'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.