Do you want to add a Dimensions column to WordPress media library? Dimensions column can help users understand the width and height of their images.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

function wh_column( $cols ) { $cols["dimensions"] = "Dimensions (w, h)"; return $cols; } function wh_value( $column_name, $id ) { $meta = wp_get_attachment_metadata($id); if(isset($meta['width'])) echo $meta['width'].' x '.$meta['height']; } add_filter( 'manage_media_columns', 'wh_column' ); add_action( 'manage_media_custom_column', 'wh_value', 10, 2 );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 62 best free WordPress blog themes or 7 best WordPress contact form plugins.