Title: get_intermediate_image_sizes
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_intermediate_image_sizes(): string[]

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#wp--skip-link--target)

Gets the available intermediate image size names.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#return)󠁿

 string[] An array of image size names.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#more-information)󠁿

Details of returned value.

    ```wp-block-preformatted
    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"
      }
    ```

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/media.php#L883)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L883-L900)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#hooks)󠁿

 [apply_filters( ‘intermediate_image_sizes’, string[] $default_sizes )](https://developer.wordpress.org/reference/hooks/intermediate_image_sizes/)

Filters the list of intermediate image sizes.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_additional_image_sizes()](https://developer.wordpress.org/reference/functions/wp_get_additional_image_sizes/)`wp-includes/media.php` |

Retrieves additional image sizes.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [wp_get_registered_image_subsizes()](https://developer.wordpress.org/reference/functions/wp_get_registered_image_subsizes/)`wp-includes/media.php` |

Returns a normalized list of all currently registered image sub-sizes.

  | 
| [WP_Widget_Media_Gallery::get_instance_schema()](https://developer.wordpress.org/reference/classes/wp_widget_media_gallery/get_instance_schema/)`wp-includes/widgets/class-wp-widget-media-gallery.php` |

Get schema for properties of a widget instance (item).

  | 
| [WP_Widget_Media_Image::get_instance_schema()](https://developer.wordpress.org/reference/classes/wp_widget_media_image/get_instance_schema/)`wp-includes/widgets/class-wp-widget-media-image.php` |

Get schema for properties of a widget instance (item).

  | 
| [WP_Widget_Media_Image::render_media()](https://developer.wordpress.org/reference/classes/wp_widget_media_image/render_media/)`wp-includes/widgets/class-wp-widget-media-image.php` |

Render the media on the frontend.

  | 
| [wp_restore_image()](https://developer.wordpress.org/reference/functions/wp_restore_image/)`wp-admin/includes/image-edit.php` |

Restores the metadata for a given attachment.

  | 
| [wp_save_image()](https://developer.wordpress.org/reference/functions/wp_save_image/)`wp-admin/includes/image-edit.php` |

Saves image to post, along with enqueued changes in `$_REQUEST['history']`.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#comment-content-730)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-730)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-730)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-730)
 4.  List available image sizes with width and height following
 5.      ```php
         /**
          * Get information about available image sizes
          */
         function get_image_sizes( $size = '' ) {
         	$wp_additional_image_sizes = wp_get_additional_image_sizes();
     
         	$sizes = array();
         	$get_intermediate_image_sizes = get_intermediate_image_sizes();
     
         	// Create the full array with sizes and crop info
         	foreach( $get_intermediate_image_sizes as $_size ) {
         		if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
         			$sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
         			$sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
         			$sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
         		} elseif ( isset( $wp_additional_image_sizes[ $_size ] ) ) {
         			$sizes[ $_size ] = array( 
         				'width' => $wp_additional_image_sizes[ $_size ]['width'],
         				'height' => $wp_additional_image_sizes[ $_size ]['height'],
         				'crop' =>  $wp_additional_image_sizes[ $_size ]['crop']
         			);
         		}
         	}
     
         	// Get only 1 size if found
         	if ( $size ) {
         		if( isset( $sizes[ $size ] ) ) {
         			return $sizes[ $size ];
         		} else {
         			return false;
         		}
         	}
         	return $sizes;
         }
         ```
     
 6.  Some examples of use of this function:
 7.      ```php
         var_dump( get_image_sizes() );
         /*
         array(4) {
           ["thumbnail"]=>
           array(3) {
             ["width"]=>
             string(3) "150"
             ["height"]=>
             string(3) "150"
             ["crop"]=>
             bool(true)
           }
           ["medium"]=>
           array(3) {
             ["width"]=>
             string(3) "300"
             ["height"]=>
             string(3) "300"
             ["crop"]=>
             bool(false)
           }
           ["large"]=>
           array(3) {
             ["width"]=>
             string(4) "1024"
             ["height"]=>
             string(4) "1024"
             ["crop"]=>
             bool(false)
           }
           ["juliobox-size"]=>
           array(3) {
             ["width"]=>
             int(211)
             ["height"]=>
             int(279)
             ["crop"]=>
             bool(false)
           }
         }
         */
     
         var_dump( get_image_sizes( 'large' ) );
         /*
         array(3) {
           ["width"]=>
           int(1024)
           ["height"]=>
           int(1024)
           ["crop"]=>
           bool(false)
         }
         */
     
         var_dump( get_image_sizes( 'foo-bar' ) );
         /*
         bool(false)
         */
         ```
     
 8.   * There is now a core function that provides exactly this functionality: [wp_get_registered_image_subsizes](https://developer.wordpress.org/reference/functions/wp_get_registered_image_subsizes/)
      * [markbranly](https://profiles.wordpress.org/markbranly/) [4 years ago](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-5610)
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%3Freplytocom%3D730%23feedback-editor-730)
 10.  [Skip to note 6 content](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#comment-content-1835)
 11.   [markcallen](https://profiles.wordpress.org/markcallen/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-1835)
 12. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-1835)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-1835)
 13. In `the get_image_sizes()` example above – note that since WordPress 4.4 there
     is a new size – ‘medium_large’.
 14. Include that in the array on line 13 to prevent errors.
 15.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%3Freplytocom%3D1835%23feedback-editor-1835)
 16.  [Skip to note 7 content](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#comment-content-5223)
 17.   [Muhammad Ayoub](https://profiles.wordpress.org/mohammadayoub96/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-5223)
 18. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-5223)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-5223)
 19. Get all possible registered image size with their names
 20.     ```php
         $wp_additional_image_sizes = wp_get_additional_image_sizes();
     
         $sizes = array();
         $get_intermediate_image_sizes = get_intermediate_image_sizes();
     
         // Create the full array with sizes and crop info
         foreach ( $get_intermediate_image_sizes as $_size ) {
           if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
             $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
             $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
             $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
           } elseif ( isset( $wp_additional_image_sizes[ $_size ] ) ) {
             $sizes[ $_size ] = array(
               'width' => $wp_additional_image_sizes[ $_size ]['width'],
               'height' => $wp_additional_image_sizes[ $_size ]['height'],
               'crop' =>  $wp_additional_image_sizes[ $_size ]['crop']
             );
           }
         }
         foreach ( $sizes as $key => $image_size ) {
           echo  '<li>' . $key . ' ' . $image_size['width'] . ' x ' . $image_size['height'] . ' ' . $image_size['crop'] . '</li>';
         }
         ```
     
 21.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%3Freplytocom%3D5223%23feedback-editor-5223)
 22.  [Skip to note 8 content](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/?output_format=md#comment-content-7040)
 23.   [Ramon Ahnert](https://profiles.wordpress.org/rahmohn/)  [  2 years ago  ](https://developer.wordpress.org/reference/functions/get_intermediate_image_sizes/#comment-7040)
 24. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-7040)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%23comment-7040)
 25. Since version 5.3.0, you can use [wp_get_registered_image_subsizes()](https://developer.wordpress.org/reference/functions/wp_get_registered_image_subsizes/)
     function to list registered image sizes with width and height.
 26.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F%3Freplytocom%3D7040%23feedback-editor-7040)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_intermediate_image_sizes%2F)
before being able to contribute a note or feedback.