mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00: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. Merges [43681] to trunk. Props TimothyBlynJacobs, danielbachhuber. Fixes #44750. git-svn-id: https://develop.svn.wordpress.org/trunk@43973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -96,7 +96,7 @@ function wp_underscore_video_template() {
|
||||
<# if ( w ) { #>width="{{ w }}"<# } #>
|
||||
<# if ( h ) { #>height="{{ h }}"<# } #>
|
||||
<?php
|
||||
$props = array(
|
||||
$props = array(
|
||||
'poster' => '',
|
||||
'preload' => 'metadata',
|
||||
);
|
||||
|
||||
@@ -375,7 +375,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.
|
||||
|
||||
Reference in New Issue
Block a user