REST API: Apply rest_post_dispatch to embedded responses.

Fixes #35628.
Props @danielbachhuber.


git-svn-id: https://develop.svn.wordpress.org/trunk@36536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
rmccue 2016-02-16 06:05:02 +00:00
parent 10bfe70f06
commit 5a945adeed

View File

@ -340,6 +340,7 @@ class WP_REST_Server {
* Allows modification of the response before returning.
*
* @since 4.4.0
* @since 4.5.0 Applied to embedded responses.
*
* @param WP_HTTP_Response $result Result to send to the client. Usually a WP_REST_Response.
* @param WP_REST_Server $this Server instance.
@ -567,6 +568,9 @@ class WP_REST_Server {
$request->set_query_params( $query_params );
$response = $this->dispatch( $request );
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request );
$embeds[] = $this->response_to_data( $response, false );
}