DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

In WordPress, it is easy to embed videos on your blog. But sometimes, dealing with video sizes is a bit painful. Today, let’s have a look at how you can adjust the size of any embedded video using a filter.

Simply paste the following code on your functions.php file. Don’t forget to adjust size on line 2 and 3.

function mycustom_embed_defaults($embed_size){
    $embed_size['width'] = 586; // Adjust values to your needs
    $embed_size['height'] = 500;
 
    return $embed_size; 
}
 
add_filter('embed_defaults', 'mycustom_embed_defaults');

Credits goes to Shailan. Thanks for the cool tip!

Leave a Comment

Your email address will not be published. Required fields are marked *