On this page
apply_filters( 'rest_pre_serve_request', bool $served, WP_HTTP_Response $result, WP_REST_Request $request, WP_REST_Server $server )
Filters whether the REST API request has already been served.
Description
Allow sending the request manually – by returning true, the API result will not be sent to the client.
Parameters
$servedbool-
Whether the request has already been served.
Default false. $resultWP_HTTP_Response-
Result to send to the client. Usually a
WP_REST_Response. $requestWP_REST_Request-
Request used to generate the response.
$serverWP_REST_Server-
Server instance.
Source
File: wp-includes/rest-api/class-wp-rest-server.php. View all references
$served = apply_filters( 'rest_pre_serve_request', false, $result, $request, $this );
Related
Used By
| Used By | Description |
|---|---|
| WP_REST_Server::serve_request() wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/rest_pre_serve_request