Home > Software design >  How to get all image sizes available for a site using add_image_size?
How to get all image sizes available for a site using add_image_size?

Time:07-28

I need to get all image sizes available for a site using themes or plugins set using the WordPress function add_image_size() [https://developer.wordpress.org/reference/functions/add_image_size/]. Could somebody point me to a code that could help me get the sizes for different sites ?

CodePudding user response:

You can get all possible thumbnail/image size from the global wordpress variable $_wp_additional_image_sizes

Simply do this where you need it:

global $_wp_additional_image_sizes;    
echo '<pre>';
print_r( $_wp_additional_image_sizes );
echo '</pre>';
  • Related