mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-15 17:18:53 +02:00
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. Props TimothyBlynJacobs. Fixes #44750. Built from https://develop.svn.wordpress.org/branches/5.0@43681 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
62a35c8545
commit
c1ddf45869
@ -372,7 +372,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
|
||||
// Wrap the data in a response object.
|
||||
$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.
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-43680';
|
||||
$wp_version = '5.0-alpha-43681';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user