reset_password() WordPress Function
If you've forgotten your WordPress password, never fear! You can easily reset it by following these steps: First, navigate to the login page. Below the password field, you'll see a link that says "Lost your password?" Click on that, and you'll be taken to a new page. On the password reset page, enter the username or email address associated with your WordPress account. Once you hit the "Reset Password" button, you'll receive an email with instructions on how to create a new password. Follow the link in the email, and you'll be taken to a new page where you can enter and confirm your new password. Once you've done that, you'll be able to log in to your WordPress site with your new password.
reset_password( WP_User $user, string $new_pass ) #
Handles resetting the user’s password.
Parameters
- $user
(WP_User)(Required)The user
- $new_pass
(string)(Required)New password for the user in plaintext
Source
File: wp-includes/user.php
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 ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |