# Register a Custom Image Size

> Adds a 600 by 400 cropped image size and makes it selectable in the editor image size dropdown.

- Type: PHP
- Runs: Run everywhere
- Category: [Media](https://wpide.com/library/category/media/)
- Tags: media, images, thumbnails
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/register-custom-image-size/

## Code

```php
add_action( 'after_setup_theme', function () {
    add_image_size( 'wpide-card', 600, 400, true );
} );

add_filter( 'image_size_names_choose', function ( $sizes ) {
    $sizes['wpide-card'] = 'Card (600 x 400)';

    return $sizes;
} );
```

## Notes

Rename the size and change the dimensions. Existing images need their thumbnails regenerated.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Register a Custom Image Size" 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/
