lostpassword_user_data
Filters the user data during a password reset request.
Allows, for example, custom validation using data other than username or email address.
Usage
add_filter( 'lostpassword_user_data', 'wp_kama_lostpassword_user_data_filter', 10, 2 ); /** * Function for `lostpassword_user_data` filter-hook. * * @param WP_User|false $user_data WP_User object if found, false if the user does not exist. * @param WP_Error $errors A WP_Error object containing any errors generated by using invalid credentials. * * @return WP_User|false */ function wp_kama_lostpassword_user_data_filter( $user_data, $errors ){ // filter... return $user_data; }
- $user_data(WP_User|false)
- WP_User object if found, false if the user does not exist.
- $errors(WP_Error)
- A WP_Error object containing any errors generated by using invalid credentials.
Changelog
Since 5.7.0 | Introduced. |
Where the hook is called
lostpassword_user_data
wp-includes/user.php 3135
$user_data = apply_filters( 'lostpassword_user_data', $user_data, $errors );