get_intermediate_image_sizes() WordPress Function

The get_intermediate_image_sizes() function is used to retrieve a list of all the intermediate image sizes that are available for use in Wordpress. This function can be useful for plugins and themes that need to know what image sizes are available for use.

get_intermediate_image_sizes() #

Gets the available intermediate image size names.


Return

(string[]) An array of image size names.


Top ↑

More Information

Details of returned value.

var_dump( get_intermediate_image_sizes() );
  array(4) {
    [0]=>
    string(9) "thumbnail"
    [1]=>
    string(6) "medium"
    [2]=>
    string(12) "medium_large"
    [3]=>
    string(5) "large"
    [4]=>
    string(10) "custom-size"
  }

Top ↑

Source

File: wp-includes/media.php

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More