From e9173ef83b3a0d1a40ef25587aa94b98ee078827 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Sat, 7 Sep 2013 16:18:26 +0000 Subject: [PATCH] Add `media_submitbox_misc_sections` and `audio_submitbox_misc_sections` filters to allow removing or adding of attachment submitbox sections containing attachment metadata. props desroj, DrewAPicture. fixes #25171. git-svn-id: https://develop.svn.wordpress.org/trunk@25296 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/media.php | 40 +++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 7b976df54e..4015869db6 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -2453,12 +2453,29 @@ function attachment_submitbox_metadata() { post_mime_type ) ): - $fields = array( + /** + * Audio and video metadata fields to be shown in the publish meta box. + * + * The key for each item in the array should correspond to an attachment + * metadata key, and the value should be the desired label. + * + * @since 3.7.0 + * + * @param array $fields { + * An array of the attachment metadata keys and labels. + * + * @type string 'mime_type' Label to be shown before the field mime_type. + * @type string 'year' Label to be shown before the field year. + * @type string 'genre' Label to be shown before the field genre. + * @type string 'length_formatted' Label to be shown before the field length_formatted. + * } + */ + $fields = apply_filters( 'media_submitbox_misc_sections', array( 'mime_type' => __( 'Mime-type:' ), 'year' => __( 'Year:' ), 'genre' => __( 'Genre:' ), 'length_formatted' => __( 'Length:' ), - ); + ) ); foreach ( $fields as $key => $label ): if ( ! empty( $meta[$key] ) ) : ?> @@ -2482,10 +2499,25 @@ function attachment_submitbox_metadata() { __( 'Audio Format:' ), 'codec' => __( 'Audio Codec:' ) - ); + ) ); foreach ( $audio_fields as $key => $label ): if ( ! empty( $meta['audio'][$key] ) ) : ?>