diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 7c0004a1d7..418389be96 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -2218,6 +2218,25 @@ function wp_ajax_save_attachment() {
}
}
+ if ( 0 === strpos( $post['post_mime_type'], 'audio/' ) ) {
+ $changed = false;
+ $id3data = wp_get_attachment_metadata( $post['ID'] );
+ if ( ! is_array( $id3data ) ) {
+ $changed = true;
+ $id3data = array();
+ }
+ foreach ( wp_get_attachment_id3_keys( (object) $post, 'edit' ) as $key => $label ) {
+ if ( isset( $changes[ $key ] ) ) {
+ $changed = true;
+ $id3data[ $key ] = sanitize_text_field( wp_unslash( $changes[ $key ] ) );
+ }
+ }
+
+ if ( $changed ) {
+ wp_update_attachment_metadata( $id, $id3data );
+ }
+ }
+
wp_update_post( $post );
wp_send_json_success();
}
diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js
index 731a1bc045..46919e79b3 100644
--- a/src/wp-includes/js/media-grid.js
+++ b/src/wp-includes/js/media-grid.js
@@ -298,10 +298,11 @@
this.$el.attr('aria-label', this.model.get( 'title' ) ).attr( 'aria-checked', false );
- this.model.on( 'change:sizes change:uploading', this.render, this );
- this.model.on( 'change:title', this._syncTitle, this );
+ this.model.on( 'change:title', this._syncTitle, this );
this.model.on( 'change:caption', this._syncCaption, this );
this.model.on( 'change:percent', this.progress, this );
+ this.model.on( 'change:album', this._syncAlbum, this );
+ this.model.on( 'change:artist', this._syncArtist, this );
// Update the selection.
this.model.on( 'add', this.select, this );
@@ -443,6 +444,7 @@
this.on( 'content:render:edit-metadata', this.editMetadataContent, this );
this.on( 'content:render:edit-image', this.editImageContentUgh, this );
+ this.on( 'close', this.detach );
// Only need a tab to Edit Image for images.
if ( 'undefined' !== typeof this.model && this.model.get( 'type' ) === 'image' ) {
@@ -465,12 +467,12 @@
} );
// Completely destroy the modal DOM element when closing it.
- this.modal.close = function() {
+ this.modal.on( 'close', function() {
self.modal.remove();
$( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */
self.resetRoute();
- };
+ } );
this.modal.content( this );
this.modal.open();
diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js
index ae183db7a0..92085ce621 100644
--- a/src/wp-includes/js/media-views.js
+++ b/src/wp-includes/js/media-views.js
@@ -5032,7 +5032,9 @@
// Ensure settings remain in sync between attachment views.
_.each({
caption: '_syncCaption',
- title: '_syncTitle'
+ title: '_syncTitle',
+ artist: '_syncArtist',
+ album: '_syncAlbum'
}, function( method, setting ) {
/**
* @param {Backbone.Model} model
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 4dda581d26..b9cc9111be 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -337,6 +337,17 @@ function wp_print_media_templates() {
+ <# if ( 'audio' === data.type ) { #>
+ __( 'Artist' ),
+ 'album' => __( 'Album' ),
+ ) as $key => $label ) : ?>
+
+
+ <# } #>
+
+ {{ data.authorName }}
+
<# if ( data.uploadedTo ) { #>
<# } #>
+