WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Embeds

Contents

It's super easy to embed videos, images, tweets, audio, and other content into your WordPress site.

In A Nutshell

All you need to do to embed something into a post or page is to post the URL to it into your content area. Make sure that the URL is on its own line and not hyperlinked (clickable when viewing the post).

For example:

Check out this cool video:

http://www.youtube.com/watch?v=dQw4w9WgXcQ

That was a cool video.

WordPress will automatically turn that into a YouTube embed, and show you a live preview in the visual editor.

Also, you can optionally wrap the URL in the [embed] shortcode. It will accomplish the same effect, but does not require the URL to be on its own line. It also allows you to set a maximum (but not fixed) width and height, like so: [embed width="123" height="456"]...[/embed]

If WordPress fails to embed your URL, you will get a hyperlink to the URL.

oEmbed

The easy embedding feature is mostly powered by oEmbed, a protocol for site A (such as your blog) to ask site B (such as YouTube) for the HTML needed to embed content from site B.

oEmbed was designed to avoid the need to copy and paste HTML from the site hosting the media you wish to embed. It supports videos, images, text, and more.

Can I Use Any URL With This?

No, not by default. WordPress will only embed URLs matching an internal whitelist. This is for security purposes.

Okay, So What Sites Can I Embed From?

You can use all of these:

Service Embed Type Since
Animoto Videos WordPress 4.0
Blip Videos WordPress 2.9
CollegeHumor Videos WordPress 4.0
DailyMotion Videos WordPress 2.9
Flickr Videos & Images WordPress 2.9
FunnyOrDie.com Videos WordPress 3.0
Hulu Videos WordPress 2.9
Imgur Images WordPress 3.9
Instagram Images WordPress 3.5
Issuu Documents WordPress 4.0
Meetup.com Various WordPress 3.9
Mixcloud Music WordPress 4.0
Photobucket Images WordPress 2.9
PollDaddy Polls & Surveys WordPress 3.0
Rdio Music WordPress 3.6
Revision3 TV shows WordPress 2.9
Scribd Documents WordPress 2.9
SlideShare Presentation slideshows WordPress 3.5
SmugMug Photos WordPress 3.0
SoundCloud Music WordPress 3.5
Spotify Music WordPress 3.6
TED Videos WordPress 4.0
Twitter Social media WordPress 3.4
Vimeo Video WordPress 2.9
WordPress.tv Videos WordPress 2.9
YouTube Videos WordPress 2.9

Notes

  • Twitter - older versions of WordPress have issues with https embeds, just remove the s from the https to fix.
  • YouTube - only public and "unlisted" videos and playlists - "private" videos will not embed.

How Can I Add or Change Support For Websites?

Adding support for an additional website depends on whether the site supports oEmbed.

Adding Support For An oEmbed-Enabled Site

If a site supports oEmbed, you'll want to call wp_oembed_add_provider() to add the site and URL format to the internal whitelist.

Adding Support For A Non-oEmbed Site

You'll need to register a handler using wp_embed_register_handler() and provide a callback function that generates the HTML.

Removing Support for An oEmbed-Enabled Site

If you wish to remove an oEmbed-enabled provider, you'll want to call wp_oembed_remove_provider.

What About oEmbed Discovery?

The oEmbed implementation in WordPress has discovery disabled. By default, you can only embed from websites that are listed on the internal whitelist. This is to prevent accidental embedding from malicious websites.

However, if you feel you are knowledgeable enough to avoid this, you can give unfiltered_html users (Administrators and Editors) the ability to embed from websites that have oEmbed discovery tags in their <head>. You merely need to install Enable oEmbed Discovery plugin.

External Resources

Changelog

  • 2.9 : Introduction of the builtin Embeds support.
  • 3.0 : SmugMug, FunnyOrDie added.
  • 3.4 : Twitter added.
  • 3.5 : Instagram, SoundCloud, SlideShare added.
  • 3.6 : Rdio, Spotify added.
  • 3.9 : Qik was removed due to the service shutting down in April 2014
  • 4.0 : Major reworking of the preview code showing embeds within the editor wp-views. Viddler was removed due to the service shutting down their oEmbed endpoint. CollegeHumor, Issuu, Mixcloud, YouTube playlists, TED talks added.

Note: In WordPress 3.5, embed options were removed from the Settings Media Screen.

This article is marked as in need of editing. You can help Codex by editing it.