mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53110 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user