# Only Your Image Aspect Ratios in the Editor

> Replaces the long list of aspect ratios offered for images and featured images with a short set you choose, so cropped images stay consistent.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: theme-json, images, aspect-ratio
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/themejson-image-aspect-ratios/

## Code

```php
// Aspect ratios: slug => [name, ratio].
$wpide_aspect_ratios = array(
    'wpide-square'    => array( 'Square', '1' ),
    'wpide-landscape' => array( 'Landscape 3:2', '3/2' ),
    'wpide-wide'      => array( 'Wide 16:9', '16/9' ),
);

add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) use ( $wpide_aspect_ratios ) {
    $ratios = array();

    foreach ( $wpide_aspect_ratios as $slug => $ratio ) {
        $ratios[] = array( 'slug' => $slug, 'name' => $ratio[0], 'ratio' => $ratio[1] );
    }

    return $theme_json->update_with( array(
        'version'  => WP_Theme_JSON::LATEST_SCHEMA,
        'settings' => array(
            'dimensions' => array(
                'aspectRatios'        => $ratios,
                'defaultAspectRatios' => false,
            ),
        ),
    ) );
} );
```

## Notes

Needs WordPress 6.6+. Ratios are written as width/height.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Only Your Image Aspect Ratios 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/
