WordPress: Display All Registered Image Sizes
By default, WordPress generates extra images for each image that is uploaded via the Media Library. These extra images are created in different sizes and are used for different things, like featured images and so forth.
In addition to the default generated images, other image sizes may be added via themes and plugins. For example, a theme may register a specifically sized image for use in the sidebar. Or some plugin may register several image sizes to be used as thumbnails for related posts. Or whatever.
So this WP-Mix tutorial shows how to display a list of all registered image sizes for your WordPress site. To also get a list of current default image sizes, visit this tutorial at Perishable Press.
Display all registered image sizes
Here is the magic code snippet to display all registered image sizes:
global $_wp_additional_image_sizes;
print '<pre>';
print_r($_wp_additional_image_sizes);
print '</pre>';
Just add that anywhere in your theme template and visit via browser. The output will look something like this:
Array
(
[1536x1536] => Array
(
[width] => 1536
[height] => 1536
[crop] =>
)
[2048x2048] => Array
(
[width] => 2048
[height] => 2048
[crop] =>
)
[featured-700] => Array
(
[width] => 700
[height] => 210
[crop] => 1
)
[featured-960] => Array
(
[width] => 960
[height] => 250
[crop] => 1
)
)
That’s all there is to it. Notice the output code includes the registered name, width, height, and crop status for each registered image. Don’t forget to remove the code when you are finished ;)