WordPress at a glance
filter is not described

rest_post_dispatch filter-hook . WP 4.4.0

Filters the API response.

Allows modification of the response before returning.

Usage

add_filter( 'rest_post_dispatch', 'filter_function_name_7377', 10, 3 );
function filter_function_name_7377( $result, $this, $request ){
	// filter...

	return $result;
}
$result(WP_HTTP_Response)
Result to send to the client. Usually a WP_REST_Response.
$this(WP_REST_Server)
Server instance.
$request(WP_REST_Request)
Request used to generate the response.

Notes

  • Since 4.5.0 Applied to embedded responses.

Where the hook is called

WP_REST_Server::serve_request()
WP_REST_Server::embed_links()
wp-includes/rest-api/class-wp-rest-server.php 344
$result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $request );
wp-includes/rest-api/class-wp-rest-server.php 586
$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request );

Where the hook is used (in WP core)

wp-includes/rest-api.php 167
add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 );
wp-includes/rest-api.php 168
add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 );