On this page
WP_REST_Users_Controller::check_reassign( int|bool $value, WP_REST_Request $request, string $param ): int|bool|WP_Error
Checks for a valid value for the reassign parameter when deleting users.
Description
The value can be an integer, ‘false’, false, or ”.
Parameters
$valueint|bool Required-
The value passed to the reassign parameter.
$requestWP_REST_Request Required-
Full details about the request.
$paramstring Required-
The parameter that is being sanitized.
Return
int|bool|WP_Error
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php. View all references
public function check_reassign( $value, $request, $param ) {
if ( is_numeric( $value ) ) {
return $value;
}
if ( empty( $value ) || false === $value || 'false' === $value ) {
return false;
}
return new WP_Error(
'rest_invalid_param',
__( 'Invalid user parameter(s).' ),
array( 'status' => 400 )
);
}
Related
Uses
| Uses | Description |
|---|---|
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| WP_Error::__construct() wp-includes/class-wp-error.php | Initializes the error. |
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_users_controller/check_reassign