# Offer Custom Image Sizes in the Editor

> Adds your registered custom image sizes to the size dropdown in the block editor and media modal, so editors can pick them when inserting images.

- Type: PHP
- Runs: Run everywhere
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: images, media, block-editor, sizes
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/dev-custom-image-sizes-in-editor/

## Code

```php
add_filter( 'image_size_names_choose', function ( $sizes ) {
    // Registered size name => label shown to editors.
    $labels = array(
        'medium_large' => 'Medium large',
    );

    foreach ( wp_get_registered_image_subsizes() as $name => $size ) {
        if ( ! isset( $sizes[ $name ] ) && isset( $labels[ $name ] ) ) {
            $sizes[ $name ] = $labels[ $name ];
        }
    }

    return $sizes;
} );
```

## Notes

The sizes must already be registered with add_image_size(). Edit $labels to give them readable names.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Offer Custom Image Sizes in the Editor" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
