Skip to content

Instantly share code, notes, and snippets.

@maor
Created January 27, 2013 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maor/4647839 to your computer and use it in GitHub Desktop.
Save maor/4647839 to your computer and use it in GitHub Desktop.
Adds a new row that shows the file size under an individual attachment dashboard page
<?php
/**
* Adds a new row that shows the file size under an individual attachment dashboard page
*
* @author Maor Chasen
*/
function mc_attachment_submitbox_filesize() {
$post = get_post();
$filesize = @filesize( get_attached_file( $post->ID ) );
if ( ! empty( $filesize ) && is_numeric( $filesize ) && $filesize > 0 ) : ?>
<div class="misc-pub-section">
<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $filesize ); ?></strong>
</div>
<?php
endif;
}
add_action( 'attachment_submitbox_misc_actions', 'mc_attachment_submitbox_filesize' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment