How to Modify oEmbed to Allow for URL Attributes

Dev Tutorials

Last Updated: Time to Read: Less than a minute

The default output of oEmbed is influenced in part by WordPress and its default YoutTube iframe code, which does not support URL attributes for doing things like hiding the video title or related videos. With oEmbeds, you can’t simply change the output of the iframe URL by pasting in the showinfo and rel attributes at the end of your WordPress content or metabox’s URL slug.

This function attempts to modify the default output to allow for this customisation. In this example, the attributes are hard-coded, so would affect all oEmbeds. You can take this further by replacing the attributes with a variable and condition linked to a Customizer, Post Meta Box or widget option, for example.

1.To play video in High Def: HD=1
2. To remove related videos: rel=0
3. To remove youtube control bar: controls=0
4. To remove frame or border: frameborder="0"
5. To remove title of video: showinfo=0