WP_REST_Users_Controller::check_reassign()
Checks for a valid value for the reassign parameter when deleting users.
The value can be an integer, 'false', false, or ''.
Method of the class: WP_REST_Users_Controller{}
No Hooks.
Return
Int|true|false|WP_Error
.
Usage
$WP_REST_Users_Controller = new WP_REST_Users_Controller(); $WP_REST_Users_Controller->check_reassign( $value, $request, $param );
- $value(int|true|false) (required)
- The value passed to the reassign parameter.
- $request(WP_REST_Request) (required)
- Full details about the request.
- $param(string) (required)
- The parameter that is being sanitized.
Changelog
Since 4.7.0 | Introduced. |
WP_REST_Users_Controller::check_reassign() WP REST Users Controller::check reassign code WP 6.6.2
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 ) ); }