rest_application_password_check_errors

The timeline below displays how wordpress function rest_application_password_check_errors has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.6

/**
 * Checks for errors when using application password-based authentication.
 *
 * @since 5.6.0
 *
 * @global WP_User|WP_Error|null $wp_rest_application_password_status
 *
 * @param WP_Error|null|true $result Error from another authentication handler,
 *                                   null if we should handle it, or another value if not.
 * @return WP_Error|null|true WP_Error if the application password is invalid, the $result, otherwise true.
 */
function rest_application_password_check_errors($result)
{
    global $wp_rest_application_password_status;
    if (!empty($result)) {
        return $result;
    }
    if (is_wp_error($wp_rest_application_password_status)) {
        $data = $wp_rest_application_password_status->get_error_data();
        if (!isset($data['status'])) {
            $data['status'] = 401;
        }
        $wp_rest_application_password_status->add_data($data);
        return $wp_rest_application_password_status;
    }
    if ($wp_rest_application_password_status instanceof WP_User) {
        return true;
    }
    return $result;
}