Title: remove_image_size
Published: April 25, 2014
Last modified: August 20, 2026

---

# remove_image_size( string $name ): bool

## In this article

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

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

Removes a new image size.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/remove_image_size/?output_format=md#parameters)󠁿

 `$name`stringrequired

The image size to remove.

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

 bool True if the image size was successfully removed, false on failure.

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

 * Useful when a plugin has registered an image size and you want to use the same
   image name in your theme but with a different size.
 * Cannot be used on [reserved image size names](https://developer.wordpress.org/reference/functions/add_image_size/#reserved-image-size-names).

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

    ```php
    function remove_image_size( $name ) {
    	global $_wp_additional_image_sizes;

    	if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
    		unset( $_wp_additional_image_sizes[ $name ] );
    		return true;
    	}

    	return false;
    }
    ```

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

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

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

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

 1.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/remove_image_size/?output_format=md#comment-content-1569)
 2.    [Nikhil Chavan](https://profiles.wordpress.org/nikschavan/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/remove_image_size/#comment-1569)
 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%2Fremove_image_size%2F%23comment-1569)
     Vote results for this note: 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%2Fremove_image_size%2F%23comment-1569)
 4.  To remove all the image sizes keeping only the default WordPress image sizes –
 5.      ```php
         function remove_extra_image_sizes() {
             foreach ( get_intermediate_image_sizes() as $size ) {
                 if ( !in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
                     remove_image_size( $size );
                 }
             }
         }
     
         add_action('init', 'remove_extra_image_sizes');
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fremove_image_size%2F%3Freplytocom%3D1569%23feedback-editor-1569)
 7.   [Skip to note 6 content](https://developer.wordpress.org/reference/functions/remove_image_size/?output_format=md#comment-content-4001)
 8.    [SherylHohman](https://profiles.wordpress.org/sherylhohman/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/remove_image_size/#comment-4001)
 9.  [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%2Fremove_image_size%2F%23comment-4001)
     Vote results for this note: 1[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%2Fremove_image_size%2F%23comment-4001)
 10. Another common case is when your (parent) theme, or a plugin creates image sizes
     that you will never use.
      Deregistering unwanted sizes will prevent WordPress 
     from generating and storing images you won’t use. This will save disk space, and
     associated costs.
 11. Of course, it only affects future image uploads.
      Plugins that “regenerate thumbnails”
     can be used to delete existing thumbnails that are not currently registered, while
     creating any missing sizes.
 12. —
 13. The article mentions that you cannot use this function on reserved image size 
     names.
      However there are a few work arounds:
 14.  * In the WordPress Settings, you can set the image size to 0px.
      * You can try the `intermediate_image_sizes_advanced` function.
      * You can put the following code in your functions.php file:
      *     ```php
            update_option( 'thumbnail_size_h', 0 );
            update_option( 'thumbnail_size_w', 0 );
            update_option( 'medium_size_h', 0 );
            update_option( 'medium_size_w', 0 );
            update_option( 'large_size_h', 0 );
            update_option( 'large_size_w', 0 );
            ```
        
 15.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fremove_image_size%2F%3Freplytocom%3D4001%23feedback-editor-4001)
 16.  [Skip to note 7 content](https://developer.wordpress.org/reference/functions/remove_image_size/?output_format=md#comment-content-1379)
 17.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/remove_image_size/#comment-1379)
 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%2Fremove_image_size%2F%23comment-1379)
     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%2Fremove_image_size%2F%23comment-1379)
 19. **Example**
 20. In a theme’s functions.php file:
 21.     ```php
         function wpdocs_remove_plugin_image_sizes() {
         	remove_image_size( 'image-name' );
         }
         add_action('init', 'wpdocs_remove_plugin_image_sizes');
         ```
     
 22. You could combine this with the add_image_size function in your theme.
 23.     ```php
         function wpdocs_remove_then_add_image_sizes() {
         	remove_image_size( 'image-name' );
         	add_image_size( 'image-name', 200, 200, true );
         }
         add_action('init', 'wpdocs_remove_then_add_image_sizes');
         ```
     
 24.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fremove_image_size%2F%3Freplytocom%3D1379%23feedback-editor-1379)
 25.  [Skip to note 8 content](https://developer.wordpress.org/reference/functions/remove_image_size/?output_format=md#comment-content-2612)
 26.   [akkis](https://profiles.wordpress.org/akkis/)  [  9 years ago  ](https://developer.wordpress.org/reference/functions/remove_image_size/#comment-2612)
 27. [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%2Fremove_image_size%2F%23comment-2612)
     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%2Fremove_image_size%2F%23comment-2612)
 28. To replace any of the default image sizes like ‘medium’, ‘large’, etc you must
     remove first and then add with new attributes.
 29.     ```php
         /**
          * Add crop attribute to 'medium' WordPress default image size
          */
         add_action( 'init', 'wpdocs_change_medium_image_size' );
         function wpdocs_change_medium_image_size() {
             remove_image_size( 'medium' );
             add_image_size( 'medium', 300, 300, true );
         }
         ```
     
 30.  * But the docs say: “Cannot be used on reserved image size names.” [https://developer.wordpress.org/reference/functions/remove_image_size/](https://developer.wordpress.org/reference/functions/remove_image_size/)
      * [nicohood](https://profiles.wordpress.org/nicohood/) [4 years ago](https://developer.wordpress.org/reference/functions/remove_image_size/#comment-5782)
 31.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fremove_image_size%2F%3Freplytocom%3D2612%23feedback-editor-2612)

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