Filter hook 'lostpassword_user_data'

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

View Source

lostpassword_user_data

Filter Hook
Description
Filters the user data during a password reset request. Allows, for example, custom validation using data other than username or email address.

Hook Information

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

Hook Parameters

Type Name Description
WP_User|false $user_data WP_User object if found, false if the user does not exist.
WP_Error $errors A WP_Error object containing any errors generated by using invalid credentials.

Usage Examples

Basic Usage
<?php
// Hook into lostpassword_user_data
add_filter('lostpassword_user_data', 'my_custom_filter', 10, 2);

function my_custom_filter($user_data, $errors) {
    // Your custom filtering logic here
    return $user_data;
}

Source Code Context

wp-includes/user.php:3208 - How this hook is used in WordPress core
<?php
3203  	 *
3204  	 * @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
3205  	 * @param WP_Error      $errors    A WP_Error object containing any errors generated
3206  	 *                                 by using invalid credentials.
3207  	 */
3208  	$user_data = apply_filters( 'lostpassword_user_data', $user_data, $errors );
3209  
3210  	/**
3211  	 * Fires before errors are returned from a password reset request.
3212  	 *
3213  	 * @since 2.1.0

PHP Documentation

<?php
/**
	 * Filters the user data during a password reset request.
	 *
	 * Allows, for example, custom validation using data other than username or email address.
	 *
	 * @since 5.7.0
	 *
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.