Gets the available intermediate image size names.
Source
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
*
* @param string[] $default_sizes An array of intermediate image size names. Defaults
* are 'thumbnail', 'medium', 'medium_large', 'large'.
*/
return apply_filters( 'intermediate_image_sizes', $default_sizes );
}
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.