lostpassword_errors
Filter HookDescription
Filters the errors encountered on a password reset request. The filtered WP_Error object may, for example, contain errors for an invalid username or email address. A WP_Error object should always be returned, but may or may not contain errors. If any errors are present in $errors, this will abort the password reset request.Hook Information
File Location |
wp-includes/user.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3238 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Error
|
$errors
|
A WP_Error object containing any errors generated by using invalid credentials. |
WP_User|false
|
$user_data
|
WP_User object if found, false if the user does not exist. |
Usage Examples
Basic Usage
<?php
// Hook into lostpassword_errors
add_filter('lostpassword_errors', 'my_custom_filter', 10, 2);
function my_custom_filter($errors, $user_data) {
// Your custom filtering logic here
return $errors;
}
Source Code Context
wp-includes/user.php:3238
- How this hook is used in WordPress core
<?php
3233 *
3234 * @param WP_Error $errors A WP_Error object containing any errors generated
3235 * by using invalid credentials.
3236 * @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
3237 */
3238 $errors = apply_filters( 'lostpassword_errors', $errors, $user_data );
3239
3240 if ( $errors->has_errors() ) {
3241 return $errors;
3242 }
3243
PHP Documentation
<?php
/**
* Filters the errors encountered on a password reset request.
*
* The filtered WP_Error object may, for example, contain errors for an invalid
* username or email address. A WP_Error object should always be returned,
* but may or may not contain errors.
*
* If any errors are present in $errors, this will abort the password reset request.
*
* @since 5.5.0
*
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
* @param WP_User|false $user_data WP_User object if found, false if the user does not exist.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.