# Change the Default Embed Size

> Sets the default maximum width and height WordPress asks for when embedding videos and other media from a link.

- Type: PHP
- Runs: Run everywhere
- Category: [Media](https://wpide.com/library/category/media/)
- Tags: embeds, video, size
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/default-embed-size/

## Code

```php
// Maximum width and height in pixels.
$wpide_embed_width  = 800;
$wpide_embed_height = 450;

add_filter( 'embed_defaults', function () use ( $wpide_embed_width, $wpide_embed_height ) {
    return array(
        'width'  => $wpide_embed_width,
        'height' => $wpide_embed_height,
    );
} );
```

## Notes

Embeds that are already cached keep their old size until the post is updated.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Default Embed 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/
