apply_filters( 'rest_dispatch_request', mixed $dispatch_result, WP_REST_Request $request, string $route, array $handler )

Filters the REST API dispatch request result.

Description

Allow plugins to override dispatching the request.

Parameters

$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.

Source

File: wp-includes/rest-api/class-wp-rest-server.php

View on Trac

Changelog

Version Description
4.5.0 Added $route and $handler parameters.
4.4.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/rest_dispatch_request