REST API: Persist attributes for attachment links
In [43437], the link definition implementation caused attachment links to be unexpectedly nested under an attributes key. This changeset restores the prior behavior. Merges [43681] to trunk. Props TimothyBlynJacobs, danielbachhuber. Fixes #44750. Built from https://develop.svn.wordpress.org/trunk@43973 git-svn-id: http://core.svn.wordpress.org/trunk@43805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
91da29d9af
commit
8169b49e75
|
@ -375,7 +375,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||||
|
|
||||||
// Wrap the data in a response object.
|
// Wrap the data in a response object.
|
||||||
$response = rest_ensure_response( $data );
|
$response = rest_ensure_response( $data );
|
||||||
$response->add_links( $links );
|
|
||||||
|
foreach ( $links as $rel => $rel_links ) {
|
||||||
|
foreach ( $rel_links as $link ) {
|
||||||
|
$response->add_link( $rel, $link['href'], $link['attributes'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters an attachment returned from the REST API.
|
* Filters an attachment returned from the REST API.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-alpha-43678';
|
$wp_version = '5.1-alpha-43973';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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