Skip to content

Instantly share code, notes, and snippets.

@nicon-dev
Created December 11, 2014 14:27
Show Gist options
  • Save nicon-dev/69b88e31cd9fac286c54 to your computer and use it in GitHub Desktop.
Save nicon-dev/69b88e31cd9fac286c54 to your computer and use it in GitHub Desktop.
show image dimensions in wordpress media library #wordpress
//show image dimentions in media library
function wh_column( $cols ) {
$cols["dimensions"] = "Dimensions";
return $cols;
}
function wh_value( $column_name, $id ) {
$meta = wp_get_attachment_metadata($id);
if(isset($meta['width']))
echo ' ' . $meta['width'].' x '.$meta['height'] . 'px';
}
add_filter( 'manage_media_columns', 'wh_column' );
add_action( 'manage_media_custom_column', 'wh_value', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment