How to Set Default oEmbed Width and Height in WordPress

According to the codex,

The default oEmbed dimensions is:

The width defaults to the content width as specified by the theme in the $content_width global. If the theme does not specify a content width, then 500px is used.

That means the oEmbed width/height is specified in the theme, if not, will use default value: 500px width

We can simply specify our own oEmbed dimension by pasting this code snippet into youractivetheme/functions.php file:

//modify the default embed dimensions
function theme_embed_defaults($defaults) {
   return $defaults;

Modify 640 and 480 according to your needs.

This entry was posted in WordPress. Bookmark the permalink.

Leave a Reply

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