Registered Image Sizes Under Tools
Adds a Tools > Image Sizes screen listing every image size WordPress creates on upload, with its width, height and crop mode, so you can see what themes and plugins have added.
Opens WPIDE on
Code
add_action( 'admin_menu', function () {
add_management_page( 'Image Sizes', 'Image Sizes', 'manage_options', 'wpide-image-sizes', function () {
$sizes = wp_get_registered_image_subsizes();
echo '<div class="wrap"><h1>Image Sizes (' . count( $sizes ) . ')</h1><table class="widefat striped"><thead><tr><th>Name</th><th>Width</th><th>Height</th><th>Crop</th></tr></thead><tbody>';
foreach ( $sizes as $name => $size ) {
$crop = $size['crop'];
if ( is_array( $crop ) ) {
$crop = 'yes (' . implode( ' ', $crop ) . ')';
} else {
$crop = $crop ? 'yes' : 'no (scaled)';
}
printf(
'<tr><td><code>%s</code></td><td>%s</td><td>%s</td><td>%s</td></tr>',
esc_html( $name ),
$size['width'] ? (int) $size['width'] . 'px' : 'any',
$size['height'] ? (int) $size['height'] . 'px' : 'any',
esc_html( $crop )
);
}
echo '</tbody></table>';
printf( '<p>Big image threshold: %s</p></div>', esc_html( ( $threshold = apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 ) ) ? $threshold . 'px' : 'off' ) );
} );
} );
Notes
Each listed size is generated for every uploaded image; remove the ones you do not use to save disk space.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.