Youtube dimensions wordpress

Matthijn picture Matthijn · Sep 30, 2011 · Viewed 13.8k times · Source

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.

Answer

gregmatys picture gregmatys · Nov 15, 2013

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