This post needs updating — some things have changed since it was initially written. The Codex article is more up to date.
See the bottom of this post for the list of changes made to this post since it was initially published. Handy if you’ve read it previously and want to see what I’ve since changed.
I’ve been working on some code for WordPress 2.9 for a while now that is designed to make embedding remote content (namely videos) into your blog a lot easier. Today the code went into the WordPress core.
If you’re into testing alpha code and would like to try it out, just checkout a copy of the WordPress trunk via SVN. You can also just wait until later this month for when the more stable WordPress 2.9 beta is planned to be released.
Using The Feature
Once you’re running the code, you’ll first want to visit Settings -> Media and check out the new “Embeds” section. The default options will work perfectly fine, but you can tweak them if you wish.

To embed something, such as a video, you have two options:
- Paste a plain-text (i.e. not hyperlinked with a
<a> tag) URL on it’s own line (that’s important) somewhere within your post. Obviously this will not work for all URLs, but more on that in a moment.
- Wrap your URL in the new
[embed] shortcode. (there’s a UI for this — click the “Add Video” icon and then “From URL”)
In order for the URL to actually turn into an embed, one of three conditions needs to be true:
- An internal handler has been supplied by the WordPress core or a plugin.
- The site hosting the external content supports the oEmbed API and the URL to the site’s provider service is know by WordPress, either via the predefined list or added by a plugin.
- There is an oEmbed discovery
<link> tag in the <head> of the entered URL which contains the URL to the site’s oEmbed provider. This option is only available to authors with the unfiltered_html capability.
If all goes well, then it’ll embed like this:
Note that no plugins were used in the above embed and the HTML was pulled directly off of Vimeo’s servers. All I did was paste this on to it’s own line: http://www.vimeo.com/240975 WordPress connected to the URL, found the discovery tag in the <head>, and used it to get the HTML back from Vimeo’s servers. It’s then cached to the post meta to avoid slow page loads (editing a post clears the cache).
Another example is Flickr. Just paste the URL to the image’s page (the page where people can leave comments, etc.) into your post. For example, here’s a picture by Donncha: http://www.flickr.com/photos/donncha/4008546362/

Default Supported Sites
The following sites are supported out of the box for all users — you can easily add more via plugins (see below) and admins can use other sites that use the oEmbed discovery tag.
- YouTube (via oEmbed)
- Blip.tv (via oEmbed)
- Flickr images and videos (via oEmbed)
- Hulu (via oEmbed)
- Viddler (via oEmbed)
- Qik.com (via oEmbed) — never heard of this site, but it was listed on oEmbed’s website, so…
- Revision3 (via oEmbed)
- Google Video (via an internal handler)
- PollDaddy (via an internal handler)
- DailyMotion (via an internal handler)
Keep reading to learn about using plugins to interact with the embed API »