Using oEmbed in WordPress

What is oEmbed?

Wikipedia says:

oEmbed is an open format designed to allow embedding content from a website into another page.

WordPress describes it as:

a protocol for site A (such as your blog) to ask site B (such as YouTube) for the HTML needed to embed content (such as a video) from site B.

And In my Words:

A Simple (yet awesome) built-in feature that embeds content from other site in your WordPress Blog/Site using only the other site's URL

And just to simplify with an example: Lets say you want to embed a YouTube video in a post or a page, So you all you need to do is paste the YouTube video URL in your post and that is it. You don't need a plugin or getting custom embed code or any thing like that.

How To Enable it on my site?

To enable the oEmbed feature head over to settings >> Media and you will see under Embeds something like this:
oEmbed in WordPress
It should be enabled by default but if not know you know where to enabled it and tweak the options a bit.

How To use it?

Well as stated before all you need to do is simply paste the URL of the content you and to embed for example if i paste in my post editor:

https://www.youtube.com/watch?v=GTnnRTTY3m4

and my editor looks like this:
Using oEmbed
then my post looks like this:
Using oEmbed
One other way is to Wrap your URL in the new shortcode. (click the “Add Video” icon and then “From URL”)

What sites are supported

By default here is the list of sites that are supported:

  • YouTube
  • Vimeo
  • DailyMotion
  • blip.tv
  • Flickr (both videos and images)
  • Viddler
  • Hulu
  • Qik
  • Revision3
  • Scribd
  • Photobucket
  • PollDaddy
  • WordPress.tv (only VideoPress-type videos for the time being)
  • SmugMug (WordPress 3.0+)
  • FunnyOrDie.com (WordPress 3.0+)
  • Twitter (WordPress 3.4+)

Add Support For More Media Types/Sites

You can add support to any site that supports oEmbed and has a discovery tag to their oEmbed provider URL in the <head> tag of their pages. For example lets add support form Slideshare:

Open up your theme's functions.php file and add:

// Add Slideshare oEmbed
function add_oembed_slideshare(){
 wp_oembed_add_provider( '#(www\.)?slideshare.net/*#i', 'www.slideshare.net/api/oembed/1', true ); 
}
add_action('init','add_oembed_slideshare');

and done, your site is now slideshare oEmbed enabled.
That is it for now so Enjoy.

Incoming search terms:

Ohad Raz

WordPress Consultant, a WordPress Developer and a WordPress Freelancer With over 10 years experience in architecting web sites and applications. WordPress Development moderator and somethimes Plugin Developer.