Is it possible to remove height and width attributes from oEmbed video embeds

The output of the oEmbed call is filtered through oembed_result and then cached in the database. Every time the content is displayed, the output is filtered again through embed_oembed_html. So you can add a filter in either of these places that checks for width and height attributes and removes them. Of course, since the code comes from the embed sources, you can’t always be sure what the formatting will look like. The second argument to both filters is the embed URL, you can check that to differentiate your handling (“if it’s from YouTube do this, if it’s from Flickr do that, …”).

Leave a Comment