rest_dispatch_request filter-hook . WP 4.4.0
Filters the REST dispatch request result.
Allow plugins to override dispatching the request.
Usage
add_filter( 'rest_dispatch_request', 'filter_function_name_6462', 10, 4 ); function filter_function_name_6462( $dispatch_result, $request, $route, $handler ){ // filter... return $dispatch_result; }
- $dispatch_result(mixed)
- Dispatch result, will be used if not empty.
- $request(WP_REST_Request)
- Request used to generate the response.
- $route(string)
- Route matched for the request.
- $handler(array)
- Route handler used for the request.
Changelog
Since 4.4.0 | Introduced. |
Since 4.5.0 | Added $route and $handler parameters. |
Where the hook is called
wp-includes/rest-api/class-wp-rest-server.php 1154
$dispatch_result = apply_filters( 'rest_dispatch_request', null, $request, $route, $handler );