Change the Default Embed Size
Sets the default maximum width and height WordPress asks for when embedding videos and other media from a link.
Opens WPIDE on
Code
// 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 add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.