Youtube dimensions wordpress

Is it possible to change the default embed dimensions of an youtube (or another video) in WordPress for your current theme? I’ve searched for a plugin and some code, but I can’t seem to find any.

What I mean is the default embed size used when you just paste an youtube url in an post or page.

Related posts

Leave a Reply

5 comments

  1. Open your theme’s functions.php file, and add the following code:

    if ( ! isset( $content_width ) ) $content_width = 600;
    

    Remember to change the number 600 appropriately for your theme. It is the maximum width in pixels for your content area.

    Once you do this, WordPress will automatically use that for the maximum width of your oEmbed elements (youtube videos, slideshare, etc).

    via wpbeginner.com

  2. The currently accepted answer has an example that uses the following shortcode:

    [youtube=http://www.youtube.com/watch?v=0Bmhjf0rKe8&w=640&h=385]
    

    The shortcode [youtube] only works if you have the Jetpack plugin installed.

    To make it work with WordPress with no Jetpack you can use the built-in [embed] shortcode like this:

    [embed width=640 height=385]http://www.youtube.com/watch?v=0Bmhjf0rKe8[/embed]
    
  3. To change the default embed size go to Settings > Media and just set a fixed width/height.

    You also have the shortcode

    [youtube=http://www.youtube.com/watch?v=0Bmhjf0rKe8&w=640&h=385]
    

    where you can manually insert width and height as params. This shortcode will overwrite the default WP settings.

  4. They’ve got rid of the fixed width/height option in the media settings of the new version of WordPress. Not sure why. It was useful!! Shortcodes don’t seem to work either.