REST API: Support embedding links in `rest_preload_api_request()`.
Props lpawlik, spacedmonkey. Fixes #51722. Built from https://develop.svn.wordpress.org/trunk@50005 git-svn-id: http://core.svn.wordpress.org/trunk@49706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c3e48b857b
commit
20d961e622
|
@ -2520,11 +2520,8 @@ function rest_preload_api_request( $memo, $path ) {
|
||||||
$response = rest_do_request( $request );
|
$response = rest_do_request( $request );
|
||||||
if ( 200 === $response->status ) {
|
if ( 200 === $response->status ) {
|
||||||
$server = rest_get_server();
|
$server = rest_get_server();
|
||||||
$data = (array) $response->get_data();
|
$embed = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false;
|
||||||
$links = $server::get_compact_response_links( $response );
|
$data = (array) $server->response_to_data( $response, $embed );
|
||||||
if ( ! empty( $links ) ) {
|
|
||||||
$data['_links'] = $links;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 'OPTIONS' === $method ) {
|
if ( 'OPTIONS' === $method ) {
|
||||||
$response = rest_send_allow_header( $response, $server, $request );
|
$response = rest_send_allow_header( $response, $server, $request );
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.7-alpha-50003';
|
$wp_version = '5.7-alpha-50005';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue