Title: rest_dispatch_request
Published: December 9, 2015
Last modified: April 28, 2025

---

# apply_filters( ‘rest_dispatch_request’, mixed $dispatch_result, WP_REST_Request $request, string $route, array $handler )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#wp--skip-link--target)

Filters the REST API dispatch request result.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#description)󠁿

Allow plugins to override dispatching the request.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#parameters)󠁿

 `$dispatch_result`mixed

Dispatch result, will be used if not empty.

`$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/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](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#source)󠁿

    ```php
    $dispatch_result = apply_filters( 'rest_dispatch_request', null, $request, $route, $handler );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/class-wp-rest-server.php#L1286)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/class-wp-rest-server.php#L1286-L1286)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Server::respond_to_request()](https://developer.wordpress.org/reference/classes/wp_rest_server/respond_to_request/)`wp-includes/rest-api/class-wp-rest-server.php` |

Dispatches the request to the callback handler.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_dispatch_request/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Added `$route` and `$handler` parameters. | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_dispatch_request%2F)
before being able to contribute a note or feedback.