How to modify size of embedded videos

February 10, 2011 at 10:18 am

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!