Handles resetting the user’s password.
Parameters
$user
WP_Userrequired- The user
$new_pass
stringrequired- New password for the user in plaintext
Source
function reset_password( $user, $new_pass ) {
/**
* Fires before the user's password is reset.
*
* @since 1.5.0
*
* @param WP_User $user The user.
* @param string $new_pass New user password.
*/
do_action( 'password_reset', $user, $new_pass );
wp_set_password( $new_pass, $user->ID );
update_user_meta( $user->ID, 'default_password_nag', false );
/**
* Fires after the user's password is reset.
*
* @since 4.4.0
*
* @param WP_User $user The user.
* @param string $new_pass New user password.
*/
do_action( 'after_password_reset', $user, $new_pass );
}
Hooks
- do_action( ‘after_password_reset’,
WP_User $user ,string $new_pass ) Fires after the user’s password is reset.
- do_action( ‘password_reset’,
WP_User $user ,string $new_pass ) Fires before the user’s password is reset.
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.