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
This commit is contained in:
parent
bd9478d512
commit
06ab86cee6
|
@ -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 ) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue