REST API: Apply rest_post_dispatch to embedded responses.

Fixes #35628.
Props @danielbachhuber.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan McCue 2016-02-16 06:06:27 +00:00
parent 03ba67a0b7
commit 3e65236aa7
2 changed files with 5 additions and 1 deletions

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 );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36535';
$wp_version = '4.5-alpha-36536';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.