Frankly speaking, the Internet is all about content sharing. Webmasters share their textual contents, products, images, videos, music and many others to achieve different purposes. And luckily, with the existence of the oEmbed protocol, all of these sharing activities can be an easy thing with WordPress powered websites. Have no idea of this protocol? This time, we have come out a beginner’s guide to WordPress oEmbed feature for post embedding.
The Basic Knowledge of oEmbed in WordPress
The oEmbed protocol allows the embedded presentation of any links or URLs on the outside websites and online platforms. Its simple API enables your website to showcase the embedded content via the content URL directly, without the coding requirement and the need to parse the resources or to paste the HTML.
WordPress adds this great feature since the version of 4.4. In this case, you can add some third party contents from the outside resources with much ease.
Here, we need to mention that if the websites or the Internet platforms allow others to embed their web contents with the oEmbed protocol, they are the oEmbed providers. And now, almost all the social media platforms are the oEmbed providers. That’s why you can effortlessly share tweets, YouTube videos, Instagram images and many more.
Likewise, if your current WordPress version is 4.4 or above, your website is also an oEmbed provider. And your web content can be shared by other people simply by pasting your post URLs.
The Utilization of oEmbed in WordPress Based Websites
The best part of the oEmbed protocol is that it allows you to say goodbye to the complicated iFrame coding for sharing something. It is true that the iFrame HTML is the most common way for embedding the web content on your site. However, for new users or some people who know nothing about coding, the iFrame properties can confuse them a lot.
In this case, the oEmbed protocol can come into play. Without any coding requirement, all you need to do is to copy and paste the content URL using the WordPress post editor. Here, you should remember that the link needs to locate on its own line and is not hyperlinked.
Note that when you paste the code using the Visual editor, you can get a preview of your embed contents. In this case, you can know how it appears when you publish the post.
If you embed the video into your blog post, the final result looks better than the preview. This is because the oEmbed protocol does not require the extra styling. If you embed the slideshow or the PDF documents, the content can appear in a dynamic manner. In this case, your readers can interact with your contents easily.
Add More oEmbed Websites
It is true that you can embed the contents from any resources using oEmbed. However, the prerequisite is that these resources are the whitelisted options. This can reduce your chances to meet the security risk that comes from some unreliable resources. And your site will not be injected by the embedded contents. The currently whitelisted sites can be found on this WordPress Codex page for Embeds.
However, you also have the freedom to add more oEmbed websites if you make sure that they are the credible sources. To achieve this, you should make use of the GenerateWP tool to create some lines of code to register the new oEmbed providers. You can check the code example in the following. And all you need to do is to replace the exact content links with your target URLs.
Now, you should edit the wp-includes/embed.php file and paste the lines of code into it.
Customize the Display of the Embedded Contents
By default, the oEmbed protocol will adjust the display of your embedded contents automatically. However, you now can make use of the Embedly plugin to decide the advanced customization. In this case, you can extend the default WordPress oEmbed feature to get more style options.
After the plugin installation, you only need to click the Embedly button from the admin panel and register for an Embedly account. After that, you firstly can get a real-time report of how many people have viewed your embeds.
Now, you can move down to the part of “Advanced Embed Settings”. Here, you can decide how your future embeds can appear on your site. For instance, you can minimize the display, showcase the light text and the sharing buttons, enter the exact width and select the alignment.
Disable the oEmbed Feature in WordPress
If your website is the oEmbed provider, it means that other webmasters can embed your content and display on their online platforms. Upon the embedding, the content only includes a small post summary, the post title and the featured image.
Frankly speaking, this leaves no harm on your site. However, some of you may still dislike this kind of content sharing. In this case, you can disable the oEmbed feature on your site. For this, you only need to install the Disable Embeds plugin to prevent others from embedding your contents.