WP_REST_Users_Controller::check_user_password PHP Method

check_user_password() public method

Performs a couple of checks like edit_user() in wp-admin/includes/user.php.
Since: 4.7.0
public check_user_password ( mixed $value, WP_REST_Request $request, string $param ) : WP_Error | string
$value mixed The password submitted in the request.
$request WP_REST_Request Full details about the request.
$param string The parameter name.
return WP_Error | string The sanitized password, if valid, otherwise an error.
    public function check_user_password($value, $request, $param)
    {
        $password = (string) $value;
        if (empty($password)) {
            return new WP_Error('rest_user_invalid_password', __('Passwords cannot be empty.'), array('status' => 400));
        }
        if (false !== strpos($password, "\\")) {
            return new WP_Error('rest_user_invalid_password', __('Passwords cannot contain the "\\" character.'), array('status' => 400));
        }
        return $password;
    }