diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index f7b22812ae..7f0ea62f6a 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -139,6 +139,10 @@ if ( 'attachment' == $post_type ) { wp_enqueue_style( 'imgareaselect' ); add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); add_action( 'edit_form_after_title', 'edit_form_image_editor' ); + + if ( preg_match( '#^audio#', $post->post_mime_type ) ) { + add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); + } } else { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); } diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index ccc4ab4b39..47bbfdb509 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2661,10 +2661,14 @@ function edit_form_image_editor( $post ) {
@@ -2765,8 +2772,6 @@ function attachment_submitbox_metadata() { */ $fields = apply_filters( 'media_submitbox_misc_sections', array( 'mime_type' => __( 'Mime-type:' ), - 'year' => __( 'Year:' ), - 'genre' => __( 'Genre:' ), 'length_formatted' => __( 'Length:' ), ) ); diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index be89c366bf..f91df90347 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -1057,3 +1057,28 @@ function post_thumbnail_meta_box( $post ) { $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); } + +/** + * Display fields for ID3 data + * + * @since 3.9.0 + * + * @param WP_Post $post + */ +function attachment_id3_data_meta_box( $post ) { + $meta = array(); + if ( ! empty( $post->ID ) ) { + $meta = wp_get_attachment_metadata( $post->ID ); + } + + foreach ( wp_get_relevant_id3_keys() as $key => $label ): ?> ++ + +
+ $label ) { + if ( isset( $post_data[ 'id3_' . $key ] ) ) { + if ( current_user_can( 'unfiltered_html' ) ) { + $id3data[ $key ] = wp_unslash( $post_data[ 'id3_' . $key ] ); + } else { + $id3data[ $key ] = wp_unslash( wp_kses_post( $post_data[ 'id3_' . $key ] ) ); + } + } + } + wp_update_attachment_metadata( $post_ID, $id3data ); + } + // Meta Stuff if ( isset($post_data['meta']) && $post_data['meta'] ) { foreach ( $post_data['meta'] as $key => $value ) { diff --git a/wp-includes/media.php b/wp-includes/media.php index d9f00267cc..6c1ddaeb01 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1018,30 +1018,26 @@ function wp_underscore_playlist_templates() { <# if ( data.image ) { #> <# } #> - <# if ( data.meta.title ) { #> - <# } else { #> - - - + + <# if ( data.meta.album ) { #> <# } #> + <# if ( data.meta.artist ) { #> <# } #> - <# } #>