How to retrieve and debug additional image sizes in WordPress websites or WooCommerce stores

WordPress provides several default image sizes for uploaded images such as thumbnail, medium, large and full. However, themes and plugins may register additional image sizes to meet specific design or functionality requirements. This code snippet can be used to retrieve these additional image sizes for debugging or troubleshooting purposes.

    global $_wp_additional_image_sizes; 
print '
print_r( $_wp_additional_image_sizes ); 
print '

This code snippet retrieves an array of additional image sizes registered by plugins or themes in a WordPress website using the global variable $_wp_additional_image_sizes, and then prints the array in a human-readable format using print_r

In real cases, this snippet may be useful for WordPress developers or site administrators who need to troubleshoot issues related to image sizes in their website. For example, a developer may want to verify if a particular plugin or theme has registered an image size correctly or if an image size has been registered multiple times by different plugins or themes, causing conflicts.

Overall, this code snippet is a helpful tool for developers and site administrators who want to get more information about the image sizes available on their WordPress website.

Hire your Codeartist

Looking for a development of your own project?

Is your agency looking for a partner?