Uses
Uses | Description |
---|---|
wp-includes/l10n.php: __() | Retrieve the translation of $text. |
wp-includes/class-wp-error.php: WP_Error::__construct() | Initialize the error. |
Check a user password for the REST API.
Performs a couple of checks like edit_user() in wp-admin/includes/user.php.
(string) (Required) The password submitted in the request.
(WP_REST_Request) (Required) Full details about the request.
(string) (Required) The parameter name.
(string|WP_Error) The sanitized password, if valid, otherwise an error.
File: wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
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; }
Version | Description |
---|---|
4.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_users_controller/check_user_password