REST API: Add routing args to rest_dispatch_request filter.

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

Fixes #35507.

Built from https://develop.svn.wordpress.org/trunk@36534


git-svn-id: http://core.svn.wordpress.org/trunk@36501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan McCue
2016-02-16 04:40:26 +00:00
parent 47bee5157b
commit 0438795671
2 changed files with 5 additions and 2 deletions

View File

@@ -874,11 +874,14 @@ class WP_REST_Server {
* Allow plugins to override dispatching the request.
*
* @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 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.
if ( null !== $dispatch_result ) {