reset_password()WP 2.5.0

Handles resetting the user's password.

Хуки из функции

Возвращает

null. Ничего (null).

Использование

reset_password( $user, $new_pass );
$user(WP_User) (обязательный)
The user
$new_pass(строка) (обязательный)
New password for the user in plaintext

Список изменений

С версии 2.5.0 Введена.

Код reset_password() WP 6.5.2

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 );
}