From 3e65236aa7edcd67eb125d424e5a419af7df7112 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Tue, 16 Feb 2016 06:06:27 +0000 Subject: [PATCH] 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 --- wp-includes/rest-api/class-wp-rest-server.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index cc9fda7014..93abf87e1b 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -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 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 0779110286..2d269d597b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.