Gets the available intermediate image size names.
Source
*
* @since 3.0.0
*
* @return string[] An array of image size names.
*/
function get_intermediate_image_sizes() {
$default_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
$additional_sizes = wp_get_additional_image_sizes();
if ( ! empty( $additional_sizes ) ) {
$default_sizes = array_merge( $default_sizes, array_keys( $additional_sizes ) );
}
/**
* Filters the list of intermediate image sizes.
*
* @since 2.5.0
*
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
List available image sizes with width and height following
Some examples of use of this function:
In
the get_image_sizes()
example above – note that since WordPress 4.4 there is a new size – ‘medium_large’.Include that in the array on line 13 to prevent errors.
Get all possible registered image size with their names
Since version 5.3.0, you can use wp_get_registered_image_subsizes() function to list registered image sizes with width and height.