From 344c4dce6881a5649ba69b50a6e9b89ff4a890ef Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 12 Jan 2023 09:03:29 +0000 Subject: [PATCH] Users: Add an action hook on `wp_set_password()`. This changeset introduces the `wp_set_password` action hook, triggered after a password is set for a given user. As several plugins are calling `wp_set_password()` directly, adding an action to the end of the function will help plugin authors to catch all instances of password setting. Props tanner-m, audrasjb. Fixes #57436. git-svn-id: https://develop.svn.wordpress.org/trunk@55056 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 8ee9724331..b3921cddaf 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -2740,6 +2740,16 @@ if ( ! function_exists( 'wp_set_password' ) ) : ); clean_user_cache( $user_id ); + + /** + * Fires after the password is set. + * + * @since 6.2.0 + * + * @param string $password The plain text password just set. + * @param mixed $user_id The ID of the user whose password was just set. + */ + do_action( 'wp_set_password', $password, $user_id ); } endif;