diff --git a/package-lock.json b/package-lock.json
index 3f81fc78a0..c339d2f7d6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "WordPress",
- "version": "5.0.0",
+ "version": "5.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index 75b92889e7..dfa0e416c5 100644
--- a/src/wp-admin/includes/template.php
+++ b/src/wp-admin/includes/template.php
@@ -1256,7 +1256,7 @@ function do_accordion_sections( $screen, $context, $object ) {
$page = $screen->id;
- $hidden = get_hidden_meta_boxes( $screen );
+ $hidden = get_hidden_meta_boxes( $screen );
?>
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index fb44261cf1..fbacf869ae 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -96,7 +96,7 @@ function wp_underscore_video_template() {
<# if ( w ) { #>width="{{ w }}"<# } #>
<# if ( h ) { #>height="{{ h }}"<# } #>
'',
'preload' => 'metadata',
);
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index e317f523aa..4707dd4a62 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
@@ -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.
diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php
index 86b66d726c..fbbc0517f6 100644
--- a/tests/phpunit/tests/rest-api/rest-attachments-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-attachments-controller.php
@@ -1467,6 +1467,11 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
$links = $response->get_links();
$this->assertArrayHasKey( 'self', $links );
+ $this->assertArrayHasKey( 'author', $links );
+
+ $this->assertCount( 1, $links['author'] );
+ $this->assertArrayHasKey( 'embeddable', $links['author'][0]['attributes'] );
+ $this->assertTrue( $links['author'][0]['attributes']['embeddable'] );
}
public function test_publish_action_ldo_not_registered() {
diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js
index d2b3f8db98..c2db0ed270 100644
--- a/tests/qunit/fixtures/wp-api-generated.js
+++ b/tests/qunit/fixtures/wp-api-generated.js
@@ -4079,27 +4079,22 @@ mockedApiResponse.MediaCollection = [
"_links": {
"self": [
{
- "attributes": [],
"href": "http://example.org/index.php?rest_route=/wp/v2/media/8"
}
],
"collection": [
{
- "attributes": [],
"href": "http://example.org/index.php?rest_route=/wp/v2/media"
}
],
"about": [
{
- "attributes": [],
"href": "http://example.org/index.php?rest_route=/wp/v2/types/attachment"
}
],
"replies": [
{
- "attributes": {
- "embeddable": true
- },
+ "embeddable": true,
"href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"
}
]