Pinterest Stumbleupon Whatsapp

oembed wordpressIf you have been using Facebook for any amount of time, you’ve probably noticed that when you post a link to a YouTube video, Facebook embeds the video into your update for you.  It also works on several other types of links such as MP3 files. I post links to recordings sometimes and this comes in handy.

Ever since version 2.9, WordPress has given users the ability to link from several services (such as Flickr and YouTube) and have the content automatically embedded without you having to grab a bunch of code. Wordpress uses the oEmbed protocol to accomplish this. You might be asking “so what is this oEmbed thing all about and how does it help a WordPress user like me?”

What Is oEmbed for WordPress?

oEmbed has been described several different ways. The WordPress Codex describes it this way:

…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.

oEmbed’s homepage also gives a description:

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

So basically, oEmbed makes it possible for a webpage (ie. a WordPress site) to turn a link into embedded media simply by sending a request to the originator of the media content (such as YouTube or Flickr) for the embed code.


OK, so what does all that mean to me as a WordPress user?

How Does oEmbed Work With WordPress?

If you remember my example at the beginning about how Facebook handles YouTube links, you will know how YouTube links work in WordPress 2.9 and later. You used to have to stop what you were doing, find the video to be embedded, and then find the embed code to paste into the HTML version of the post you were working on.

This process worked fine but now things are easier because of oEmbed. Now, just grab the link. There are two ways of using the link. Allow me to demonstrate how it works using my own WordPress site.

  • Grab the link from the YouTube page.

oembed wordpress

  • Paste the link on its own line.

embed content from another site

  • This is what you’ll see.

embed content from another site

  • Or you can use a short code and type something similar to this and have some flexibility with formatting:

embed content from another site

  • This example would look like this:

oembed wordpress

In basic terms that is what oEmbed is and how it works with WordPress.  WordPress does not allow use of just any old URL with oEmbed for security reasons. There is a list of accepted sites on the WordPress Codex page about embeds.  It should also be mentioned that you can add more sites. This process should be left for another article to cover.

WordPress seems to be on a never ending journey to make our lives easier.  This embedding ability is just another small example. What WordPress feature do you like that makes your life easier? Have you tried oEmbed?

Leave a Reply

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