It's super easy to embed videos, images, tweets, audio, and other content into your WordPress site using a simple Shortcode.
To embed a video or another object into a post or page, place its URL into the content area. Make sure the URL is on its own line and not hyperlinked (clickable when viewing the post).
Check out this cool video: http://www.youtube.com/watch?v=dQw4w9WgXcQ That was a cool video.
WordPress will automatically turn the URL into a YouTube embed and provide a live preview in the visual editor.
Another option is to 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. Using
[embed] allows for the inclusion of a maximum (but not fixed) width and height:
[embed width="123" height="456"]...[/embed]
If WordPress fails to embed the URL, the post will contain a hyperlink to the URL.
Also note that you cannot use
do_shortcode as usual with
[embed], however there is a workaround on the do_shortcode page.
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.
No, not by default. WordPress will only embed URLs matching an internal whitelist. This is for security purposes.
You can use all of these:
|Flickr||Videos & Images||WordPress 2.9|
|Kickstarter||Projects||(Coming in WordPress 4.2)|
|PollDaddy||Polls & Surveys||WordPress 3.0|
|Revision3||TV shows||WordPress 2.9|
|SlideShare||Presentation slideshows||WordPress 3.5|
|Tumblr||Various||(Coming in WordPress 4.2)|
|Social media||WordPress 3.4|
Adding support for an additional website depends on whether the site supports oEmbed.
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.
You'll need to register a handler using wp_embed_register_handler() and provide a callback function that generates the HTML.
If you wish to remove an oEmbed-enabled provider, you'll want to call wp_oembed_remove_provider.
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.