attachment_submitbox_metadata

The timeline below displays how wordpress function attachment_submitbox_metadata has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    $author = new WP_User($post->post_author);
    $uploaded_by_name = __('(no author)');
    $uploaded_by_link = '';
    if ($author->exists()) {
        $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
        $uploaded_by_link = get_edit_user_link($author->ID);
    }
    ?>
	<div class="misc-pub-section misc-pub-uploadedby">
		<?php 
    if ($uploaded_by_link) {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <a href="<?php 
        echo $uploaded_by_link;
        ?>"><strong><?php 
        echo $uploaded_by_name;
        ?></strong></a>
		<?php 
    } else {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <strong><?php 
        echo $uploaded_by_name;
        ?></strong>
		<?php 
    }
    ?>
	</div>

	<?php 
    if ($post->post_parent) {
        $post_parent = get_post($post->post_parent);
        if ($post_parent) {
            $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
            $uploaded_to_link = get_edit_post_link($post->post_parent, 'raw');
            ?>
			<div class="misc-pub-section misc-pub-uploadedto">
				<?php 
            if ($uploaded_to_link) {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <a href="<?php 
                echo $uploaded_to_link;
                ?>"><strong><?php 
                echo $uploaded_to_title;
                ?></strong></a>
				<?php 
            } else {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <strong><?php 
                echo $uploaded_to_title;
                ?></strong>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
    }
    ?>

	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
		<span class="copy-to-clipboard-container">
			<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php 
    _e('Copy URL to clipboard');
    ?></button>
			<span class="success hidden" aria-hidden="true"><?php 
    _e('Copied!');
    ?></span>
		</span>
	</div>
	<div class="misc-pub-section misc-pub-download">
		<a href="<?php 
    echo esc_attr($att_url);
    ?>" download><?php 
    _e('Download file');
    ?></a>
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = wp_filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image word-wrap-break-word">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<strong><?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?></strong>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 6.1

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    $author = new WP_User($post->post_author);
    $uploaded_by_name = __('(no author)');
    $uploaded_by_link = '';
    if ($author->exists()) {
        $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
        $uploaded_by_link = get_edit_user_link($author->ID);
    }
    ?>
	<div class="misc-pub-section misc-pub-uploadedby">
		<?php 
    if ($uploaded_by_link) {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <a href="<?php 
        echo $uploaded_by_link;
        ?>"><strong><?php 
        echo $uploaded_by_name;
        ?></strong></a>
		<?php 
    } else {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <strong><?php 
        echo $uploaded_by_name;
        ?></strong>
		<?php 
    }
    ?>
	</div>

	<?php 
    if ($post->post_parent) {
        $post_parent = get_post($post->post_parent);
        if ($post_parent) {
            $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
            $uploaded_to_link = get_edit_post_link($post->post_parent, 'raw');
            ?>
			<div class="misc-pub-section misc-pub-uploadedto">
				<?php 
            if ($uploaded_to_link) {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <a href="<?php 
                echo $uploaded_to_link;
                ?>"><strong><?php 
                echo $uploaded_to_title;
                ?></strong></a>
				<?php 
            } else {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <strong><?php 
                echo $uploaded_to_title;
                ?></strong>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
    }
    ?>

	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
		<span class="copy-to-clipboard-container">
			<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php 
    _e('Copy URL to clipboard');
    ?></button>
			<span class="success hidden" aria-hidden="true"><?php 
    _e('Copied!');
    ?></span>
		</span>
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = wp_filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image word-wrap-break-word">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 6.1

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    $author = new WP_User($post->post_author);
    $uploaded_by_name = __('(no author)');
    $uploaded_by_link = '';
    if ($author->exists()) {
        $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
        $uploaded_by_link = get_edit_user_link($author->ID);
    }
    ?>
	<div class="misc-pub-section misc-pub-uploadedby">
		<?php 
    if ($uploaded_by_link) {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <a href="<?php 
        echo $uploaded_by_link;
        ?>"><strong><?php 
        echo $uploaded_by_name;
        ?></strong></a>
		<?php 
    } else {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <strong><?php 
        echo $uploaded_by_name;
        ?></strong>
		<?php 
    }
    ?>
	</div>

	<?php 
    if ($post->post_parent) {
        $post_parent = get_post($post->post_parent);
        if ($post_parent) {
            $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
            $uploaded_to_link = get_edit_post_link($post->post_parent, 'raw');
            ?>
			<div class="misc-pub-section misc-pub-uploadedto">
				<?php 
            if ($uploaded_to_link) {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <a href="<?php 
                echo $uploaded_to_link;
                ?>"><strong><?php 
                echo $uploaded_to_title;
                ?></strong></a>
				<?php 
            } else {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <strong><?php 
                echo $uploaded_to_title;
                ?></strong>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
    }
    ?>

	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
		<span class="copy-to-clipboard-container">
			<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php 
    _e('Copy URL to clipboard');
    ?></button>
			<span class="success hidden" aria-hidden="true"><?php 
    _e('Copied!');
    ?></span>
		</span>
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 5.6

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    $author = get_userdata($post->post_author);
    $uploaded_by_name = __('(no author)');
    $uploaded_by_link = '';
    if ($author->exists()) {
        $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
        $uploaded_by_link = get_edit_user_link($author->ID);
    }
    ?>
	<div class="misc-pub-section misc-pub-uploadedby">
		<?php 
    if ($uploaded_by_link) {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <a href="<?php 
        echo $uploaded_by_link;
        ?>"><strong><?php 
        echo $uploaded_by_name;
        ?></strong></a>
		<?php 
    } else {
        ?>
			<?php 
        _e('Uploaded by:');
        ?> <strong><?php 
        echo $uploaded_by_name;
        ?></strong>
		<?php 
    }
    ?>
	</div>

	<?php 
    if ($post->post_parent) {
        $post_parent = get_post($post->post_parent);
        if ($post_parent) {
            $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
            $uploaded_to_link = get_edit_post_link($post->post_parent, 'raw');
            ?>
			<div class="misc-pub-section misc-pub-uploadedto">
				<?php 
            if ($uploaded_to_link) {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <a href="<?php 
                echo $uploaded_to_link;
                ?>"><strong><?php 
                echo $uploaded_to_title;
                ?></strong></a>
				<?php 
            } else {
                ?>
					<?php 
                _e('Uploaded to:');
                ?> <strong><?php 
                echo $uploaded_to_title;
                ?></strong>
				<?php 
            }
            ?>
			</div>
			<?php 
        }
    }
    ?>

	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
		<span class="copy-to-clipboard-container">
			<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php 
    _e('Copy URL to clipboard');
    ?></button>
			<span class="success hidden" aria-hidden="true"><?php 
    _e('Copied!');
    ?></span>
		</span>
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 5.5

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
		<span class="copy-to-clipboard-container">
			<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php 
    _e('Copy URL');
    ?></button>
			<span class="success hidden" aria-hidden="true"><?php 
    _e('Copied!');
    ?></span>
		</span>
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 5.4

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ('image' !== $mime_type && !empty($meta['mime_type'])) {
            if ("{$mime_type}/" . strtolower($matches[1]) !== $meta['mime_type']) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
    if (!empty($meta['original_image'])) {
        ?>
		<div class="misc-pub-section misc-pub-original-image">
			<?php 
        _e('Original image:');
        ?>
			<a href="<?php 
        echo esc_url(wp_get_original_image_url($attachment_id));
        ?>">
				<?php 
        echo esc_html(wp_basename(wp_get_original_image_path($attachment_id)));
        ?>
			</a>
		</div>
		<?php 
    }
}

WordPress Version: 5.3

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $attachment_id = $post->ID;
    $file = get_attached_file($attachment_id);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($attachment_id);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$attachment_id}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($attachment_id);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?>
		<strong>
		<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
		<div class="misc-pub-section misc-pub-filesize">
			<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
		</div>
		<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?>
				<strong>
				<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
				</strong>
			</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
			<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
				<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
			</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
		<div class="misc-pub-section misc-pub-dimensions">
			<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
		</div>
		<?php 
    }
}

WordPress Version: 5.1

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $file = get_attached_file($post->ID);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong>
					<?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?>
		</strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong>
						<?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?>
			</strong>
		</div>
			<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
		</div>
			<?php 
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
		<?php 
    }
}

WordPress Version: 4.9

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $file = get_attached_file($post->ID);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong><?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?></strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        $fields = array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:'));
        /**
         * Filters the 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $fields = apply_filters('media_submitbox_misc_sections', $fields, $post);
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?></strong>
		</div>
	<?php 
        }
        $fields = array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:'));
        /**
         * Filters the audio attachment 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
         * @since 4.9.0 Added the `$post` parameter.
         *
         * @param array   $fields An array of the attachment metadata keys and labels.
         * @param WP_Post $post   WP_Post object for the current attachment.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', $fields, $post);
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
		</div>
	<?php 
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
<?php 
    }
}

WordPress Version: 4.6

/**
 * Displays non-editable attachment metadata in the publish meta box.
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $file = get_attached_file($post->ID);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong><?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?></strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        /**
         * Filters the 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.
         */
        $fields = apply_filters('media_submitbox_misc_sections', array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:')));
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?></strong>
		</div>
	<?php 
        }
        /**
         * Filters the audio attachment 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.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:')));
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
		</div>
	<?php 
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
<?php 
    }
}

WordPress Version: 4.4

/**
 * Displays non-editable attachment metadata in the publish metabox
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $file = get_attached_file($post->ID);
    $filename = esc_html(wp_basename($file));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
		<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong><?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?></strong>
	</div>

	<?php 
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        /**
         * Filter the 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.
         */
        $fields = apply_filters('media_submitbox_misc_sections', array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:')));
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?></strong>
		</div>
	<?php 
        }
        /**
         * Filter the audio attachment 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.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:')));
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
		</div>
	<?php 
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
<?php 
    }
}

WordPress Version: 3.9

/**
 * Displays non-editable attachment metadata in the publish metabox
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $filename = esc_html(wp_basename($post->guid));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    /** This filter is documented in wp-admin/includes/media.php */
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
			<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
			<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong><?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
        list($mime_type) = explode('/', $post->post_mime_type);
        if ($mime_type !== 'image' && !empty($meta['mime_type'])) {
            if ($meta['mime_type'] !== "{$mime_type}/" . strtolower($matches[1])) {
                echo ' (' . $meta['mime_type'] . ')';
            }
        }
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?></strong>
	</div>

	<?php 
    $file = get_attached_file($post->ID);
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        /**
         * Filter the 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.
         */
        $fields = apply_filters('media_submitbox_misc_sections', array('length_formatted' => __('Length:'), 'bitrate' => __('Bitrate:')));
        foreach ($fields as $key => $label) {
            if (empty($meta[$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            switch ($key) {
                case 'bitrate':
                    echo round($meta['bitrate'] / 1000) . 'kb/s';
                    if (!empty($meta['bitrate_mode'])) {
                        echo ' ' . strtoupper(esc_html($meta['bitrate_mode']));
                    }
                    break;
                default:
                    echo esc_html($meta[$key]);
                    break;
            }
            ?></strong>
		</div>
	<?php 
        }
        /**
         * Filter the audio attachment 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.
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:')));
        foreach ($audio_fields as $key => $label) {
            if (empty($meta['audio'][$key])) {
                continue;
            }
            ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
            echo sanitize_html_class($key);
            ?>">
			<?php 
            echo $label;
            ?> <strong><?php 
            echo esc_html($meta['audio'][$key]);
            ?></strong>
		</div>
	<?php 
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
<?php 
    }
}

WordPress Version: 3.7

/**
 * Displays non-editable attachment metadata in the publish metabox
 *
 * @since 3.5.0
 */
function attachment_submitbox_metadata()
{
    $post = get_post();
    $filename = esc_html(wp_basename($post->guid));
    $media_dims = '';
    $meta = wp_get_attachment_metadata($post->ID);
    if (isset($meta['width'], $meta['height'])) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="misc-pub-section misc-pub-attachment">
			<label for="attachment_url"><?php 
    _e('File URL:');
    ?></label>
			<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php 
    echo esc_attr($att_url);
    ?>" />
	</div>
	<div class="misc-pub-section misc-pub-filename">
		<?php 
    _e('File name:');
    ?> <strong><?php 
    echo $filename;
    ?></strong>
	</div>
	<div class="misc-pub-section misc-pub-filetype">
		<?php 
    _e('File type:');
    ?> <strong><?php 
    if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
        echo esc_html(strtoupper($matches[1]));
    } else {
        echo strtoupper(str_replace('image/', '', $post->post_mime_type));
    }
    ?></strong>
	</div>

	<?php 
    $file = get_attached_file($post->ID);
    $file_size = false;
    if (isset($meta['filesize'])) {
        $file_size = $meta['filesize'];
    } elseif (file_exists($file)) {
        $file_size = filesize($file);
    }
    if (!empty($file_size)) {
        ?>
			<div class="misc-pub-section misc-pub-filesize">
				<?php 
        _e('File size:');
        ?> <strong><?php 
        echo size_format($file_size);
        ?></strong>
			</div>
			<?php 
    }
    if (preg_match('#^(audio|video)#', $post->post_mime_type)) {
        /**
         * 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])) {
                ?>
		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php 
                echo sanitize_html_class($key);
                ?>">
			<?php 
                echo $label;
                ?> <strong><?php 
                echo esc_html($meta[$key]);
                ?></strong>
		</div>
	<?php 
            }
        }
        if (!empty($meta['bitrate'])) {
            ?>
		<div class="misc-pub-section misc-pub-bitrate">
			<?php 
            _e('Bitrate:');
            ?> <strong><?php 
            echo round($meta['bitrate'] / 1000), 'kb/s';
            if (!empty($meta['bitrate_mode'])) {
                echo ' ', strtoupper($meta['bitrate_mode']);
            }
            ?></strong>
		</div>
	<?php 
        }
        /**
         * Audio attachment 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 'dataformat' Label to be shown before the field dataformat.
         *     @type string 'codec'      Label to be shown before the field codec.
         * }
         */
        $audio_fields = apply_filters('audio_submitbox_misc_sections', array('dataformat' => __('Audio Format:'), 'codec' => __('Audio Codec:')));
        foreach ($audio_fields as $key => $label) {
            if (!empty($meta['audio'][$key])) {
                ?>
		<div class="misc-pub-section misc-pub-audio misc-pub-<?php 
                echo sanitize_html_class($key);
                ?>">
			<?php 
                echo $label;
                ?> <strong><?php 
                echo esc_html($meta['audio'][$key]);
                ?></strong>
		</div>
	<?php 
            }
        }
    }
    if ($media_dims) {
        ?>
	<div class="misc-pub-section misc-pub-dimensions">
		<?php 
        _e('Dimensions:');
        ?> <strong><?php 
        echo $media_dims;
        ?></strong>
	</div>
<?php 
    }
}