Halloween Sale 15% off Ends in See the plans
PHP

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.

Don’t have WPIDE yet? Install it on your site

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

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.