When adding outside media to your WordPress posts, such as YouTube videos or tweets, you may think you need to use the embed code provided. If you run a WordPress site that has multiple users, you can run into problems when users who are assigned the role of “Contributor”, as one example, can’t insert iFrame codes due to inherent permissions with that role. It is a security feature because adding certain code can be used to insert malware, especially iFrames. This is where oEmbed and WordPress are awesome and make things so simple. With the simple act of pasting a link in WordPress’ visual editor, the content is automatically embedded and responsive.
What is oEmbed?
oEmbed is a web protocol that allows one site–your site–to communicate with another site–YouTube, as an example. It basically works by having your site say to YouTube, “Hey, I want to add this video to my post. Can you please send me the HTML? Thanks!”
YouTube, being the nice person they are, says, “Sure thing! I like when my content is shared! I hope it jazzes up your post!”
This eliminates not only the need to find the embed code, switch to the Text Editor, find where you want the video to appear, and paste it, but it also solves the issues with permissions that are inherent with certain user roles.
How Do I Embed Content?
It’s really simple. Simply copy the link and paste it in the WordPress Visual Editor on its own line, without any formatting (no left, right, center, justify justification). The tweet below has been embedded by simply copying and pasting the link in the Visual Editor.
Another very happy and satisifed customer. https://t.co/eropeFplzr
Need help with your WordPress site? Hire us!
— Skookum Monkey (@SkookumMonkey) February 16, 2016
What Can I Embed?
The list is long and continues to grow with every other WordPress update. Some of the most commonly shared content include:
- Posts from other sites that are powered by WordPress
When WordPress 4.4 was released (WordPress is currently at 4.5), the following were added:
- Reverb Nation
- Reddit Comments
- Speaker Deck
Here is the full list of sites that WordPress has whitelisted for use with oEmbed. There are quite a lot.
Tomorrow, we will be started our WordPress Basics series for newsletter subscribers. If you haven’t already, sign up for our newsletter and learn all about WordPress and get better at CSS, one email at a time.