Action hook 'password_reset'

in WP Core File wp-includes/user.php at line 3432

View Source

password_reset

Action Hook
Description
Fires before the user's password is reset.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Action
Line Number 3432

Hook Parameters

Type Name Description
WP_User $user The user.
string $new_pass New user password.

Usage Examples

Basic Usage
<?php
// Hook into password_reset
add_action('password_reset', 'my_custom_function', 10, 2);

function my_custom_function($user, $new_pass) {
    // Your custom code here
}

Source Code Context

wp-includes/user.php:3432 - How this hook is used in WordPress core
<?php
3427  	 * @since 1.5.0
3428  	 *
3429  	 * @param WP_User $user     The user.
3430  	 * @param string  $new_pass New user password.
3431  	 */
3432  	do_action( 'password_reset', $user, $new_pass );
3433  
3434  	wp_set_password( $new_pass, $user->ID );
3435  	update_user_meta( $user->ID, 'default_password_nag', false );
3436  
3437  	/**

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.