REST API: Add routing args to rest_dispatch_request filter.

This allows requests to be hijacked via the filter more easily.

Fixes #35507.


git-svn-id: https://develop.svn.wordpress.org/trunk@36534 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan McCue 2016-02-16 04:40:01 +00:00
parent d7e7c0b81b
commit 66fc70f0e1
1 changed files with 4 additions and 1 deletions

View File

@ -874,11 +874,14 @@ class WP_REST_Server {
* Allow plugins to override dispatching the request. * Allow plugins to override dispatching the request.
* *
* @since 4.4.0 * @since 4.4.0
* @since 4.5.0 $route and $handler parameters added.
* *
* @param bool $dispatch_result Dispatch result, will be used if not empty. * @param bool $dispatch_result Dispatch result, will be used if not empty.
* @param WP_REST_Request $request Request used to generate the response. * @param WP_REST_Request $request Request used to generate the response.
* @param string $route Route matched for the request.
* @param array $handler Route handler used for the request.
*/ */
$dispatch_result = apply_filters( 'rest_dispatch_request', null, $request ); $dispatch_result = apply_filters( 'rest_dispatch_request', null, $request, $route, $handler );
// Allow plugins to halt the request via this filter. // Allow plugins to halt the request via this filter.
if ( null !== $dispatch_result ) { if ( null !== $dispatch_result ) {