From 06ab86cee6626a928d899fe208bcb8c98af2808b Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Fri, 8 Apr 2022 17:29:01 +0000 Subject: [PATCH] REST API: Use `rest_parse_embed_param` function in `WP_REST_Server` class. Ensure that the value get parameter `_embed ` that is passed to the `envelope_response` method, is run through the `rest_parse_embed_param` function. Props Spacedmonkey, johnbillion, TimothyBlynJacobs. Fixes #54015. Built from https://develop.svn.wordpress.org/trunk@53110 git-svn-id: http://core.svn.wordpress.org/trunk@52699 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api/class-wp-rest-server.php | 6 ++++-- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 056447f545..c38914c7bf 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -438,7 +438,8 @@ class WP_REST_Server { // Wrap the response in an envelope if asked for. if ( isset( $_GET['_envelope'] ) ) { - $result = $this->envelope_response( $result, isset( $_GET['_embed'] ) ); + $embed = isset( $_GET['_embed'] ) ? rest_parse_embed_param( $_GET['_embed'] ) : false; + $result = $this->envelope_response( $result, $embed ); } // Send extra data from response objects. @@ -730,9 +731,10 @@ class WP_REST_Server { * data instead. * * @since 4.4.0 + * @since 6.0.0 The $embed parameter can now contain a list of link relations to include * * @param WP_REST_Response $response Response object. - * @param bool $embed Whether links should be embedded. + * @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links. * @return WP_REST_Response New response with wrapped data */ public function envelope_response( $response, $embed ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 651aabeafa..e6249abe99 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53109'; +$wp_version = '6.0-alpha-53110'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.