Should I Use oEmbed to Display a Client\’s Website in a WordPress Plugin?
In February of 2021, the Open Financial Network (O.F.N.) released a WordPress plugin that allows clients to embed their websites, social media accounts, and email addresses into their WordPress content. The concept is simple — when a user creates a blog post, they can select an “iframe” to display content from a URL they specify.
The advantage of this method is that it takes the load off of the client. When the user clicks “embed,” the website will load inside the iframe — the user never has to leave the article (or blog post, for that matter).
However, just because the iframe method is simple and convenient for the user doesn’t mean it’s without its drawbacks. Here are a few things you should know about the oEmbed API before you start using it in your WordPress plugins.
Since the oEmbed API was first released in 2018, the major browser support has been fantastic. There are no known issues with the plugin as of February 2021, and all modern browsers (like Google Chrome, Mozilla Firefox, and Apple Safari) support the API.
In case you’re curious, the API is not supported in Internet Explorer or Microsoft Edge. However, you can still use the iframe method to display websites in those older browsers.
Although all modern browsers support the oEmbed API, the ability to display content from a URL is limited to a single user at a time. When a user tries to visit a website that is being displayed in an iframe, the user will simply be presented with a blank screen.
This means that if you have a client with an extremely large website, you might want to look into alternative methods of displaying content.
Users can’t help but be suspicious of content they see in the form of advertisements. When a user sees a sponsored post or an advertisement masquerading as content, it gives the impression that the content is unreliable.
This is why, when WordPress first added support for the oEmbed API, it came with an “ad network” field that allows website owners to choose what type of advertisements they’d like to see inside their posts.
By default, WordPress displays five different types of advertisements in the form of icons above the post’s content area. When a user chooses to “embed” a website, they have the option of selecting one of the ad networks supported by the WordPress community.
For some, the ability to have choice in this regard might be disconcerting. While others might see it as a benefit. As you’d expect, many people are somewhere in the middle.
Just because you have the ability to choose which type of advertisements to display doesn’t mean that you’re not subject to content censorship. If you make the wrong choice, you could end up with an error on your WordPress site from a content moderator.
This is why there is also an “advanced” option that will appear below the post’s content area when the user selects to “embed” a website. If the user wants to avoid having ads or marketing messages embedded in their content, they can select the “no ads” option from the advanced menu.
Although this field is called “advanced,” it actually does very little for the user. All it does is hide the content area and show the selected iframe. The field doesn’t offer any sort of protection against content censorship.
Even when a user selects the “no ads” option in the “ad network” field, they are still opening their content up to the risk of having ads or marketing messages shoved down their throats. Just because you can pick and choose what type of adverts you want to see inside your post doesn’t mean that the content is trustworthy.
As with any other piece of software, bugs and errors sometimes creep in. If you’re reliant on a third party to provide content for your WordPress site, you’ll have to deal with any issues that arise.
Hopefully, you’ve found this information about the oEmbed API helpful. Just remember that, just because the method is easy to use and it might even be convenient for your client, it doesn’t mean that it’s without its drawbacks. And, as with anything else, there are always options — like the iframe method or creating your own custom HTML widget that can display content from a URL.