Make WordPress Core


Ignore:
Timestamp:
06/18/2020 08:22:16 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Login and Registration: Introduce lostpassword_errors filter in retrieve_password() for errors encountered on a password reset request.

This complements the registration_errors filter in register_new_user().

Props wpdo5ea, dilipbheda.
Fixes #49521.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r48059 r48084  
    382382     */
    383383    do_action( 'lostpassword_post', $errors, $user_data );
     384
     385    /**
     386     * Filters the errors encountered on a password reset request.
     387     *
     388     * The filtered WP_Error object may, for example, contain errors for an invalid
     389     * username or email address. A WP_Error object should always be returned,
     390     * but may or may not contain errors.
     391     *
     392     * If any errors are present in $errors, this will abort the password reset request.
     393     *
     394     * @since 5.5.0
     395     *
     396     * @param WP_Error $errors A WP_Error object containing any errors generated
     397     *                         by using invalid credentials.
     398     * @param WP_User|false    WP_User object if found, false if the user does not exist.
     399     */
     400    $errors = apply_filters( 'lostpassword_errors', $errors, $user_data );
    384401
    385402    if ( $errors->has_errors() ) {
Note: See TracChangeset for help on using the changeset viewer.