In Adding Custom Endpoints, validate_callback for arguments list is described like below.
validate_callback: Used to pass a function that will be passed the value of the argument. That function should return true if the value is valid, and false if not.
source: https://github.com/WP-API/docs/blob/master/extending-the-rest-api/adding-custom-endpoints.md?plain=1#L123
But it seems that extra descriptions are required.
- It also accepts
WP_Error as return value. WP_Error adds extra messages to response.
false is checked strictly, so other falsey values like '', 0, and null will be recognized as valid.
Code is here: https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/class-wp-rest-request.php#L911-L923
In Adding Custom Endpoints,
validate_callbackfor arguments list is described like below.source: https://github.com/WP-API/docs/blob/master/extending-the-rest-api/adding-custom-endpoints.md?plain=1#L123
But it seems that extra descriptions are required.
WP_Erroras return value.WP_Erroradds extra messages to response.falseis checked strictly, so other falsey values like'',0, andnullwill be recognized asvalid.Code is here: https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/class-wp-rest-request.php#L911-L923