Filter hook 'rest_pre_dispatch'
in WP Core File wp-includes/rest-api/class-wp-rest-server.php at line 1016
Description
Filters the pre-calculated result of a REST API dispatch request. Allow hijacking the request before dispatching by returning a non-empty. The returned value will be used to serve the request instead.
Occurrences
Filename |
Line Number |
wp-includes/rest-api/class-wp-rest-server.php |
1016 |
wp-includes/rest-api/class-wp-rest-server.php |
1767 |
Parameters
Type |
Name |
Description |
mixed |
$result |
Response to replace the requested version with. Can be anything a normal endpoint can return, or null to not hijack the request. |
WP_REST_Server |
$server |
Server instance. |
WP_REST_Request |
$request |
Request used to generate the response. |
PHP Doc
/**
* Filters the pre-calculated result of a REST API dispatch request.
*
* Allow hijacking the request before dispatching by returning a non-empty. The returned value
* will be used to serve the request instead.
*
* @since 4.4.0
*
* @param mixed $result Response to replace the requested version with. Can be anything
* a normal endpoint can return, or null to not hijack the request.
* @param WP_REST_Server $server Server instance.
* @param WP_REST_Request $request Request used to generate the response.
*/