I recently created the “Metronet Embed Facebook posts” plugin for my employers Metronet.

Embedding Facebook posts is something which was only made possible recently by Facebook. Unfortunately, unlike most of their competitors, Facebook does not provide a simple, easy to use system for handling embed codes. They require you to muck around creating a Facebook application and do not provide a simple oEmbed API.

To work around this, I created a Facebook application specifically for the WordPress plugin and implemented a custom oEmbed system within the plugin. I originally developed it using WordPress shortcodes only, but my colleague Ronald Huereca recommended I use the oEmbed API which turned out to be an excellent suggestion. Now if you “install the plugin and add a URL to your page, it will be embedded automatically just like the one below 😀

Negatives

I think for many situations it may still be advisable to use a basic image with a link rather than embedding the post. Embedding is slow and if Facebook has problems, or the original content is edited or deleted, then your own post can be affected. But for many other times, the embedding process will be ideal and hopefully this plugin will make implementing them a lot easier.

Should this be in WordPress core?

Although WordPress includes oEmbed support for many different services, it is unlikely that support for Facebook embedded posts will be added anytime soon. All of the existing services with oEmbed support in WordPress are officially supported by the services themselves, but at the time of writing, Facebook had not provided any official support for oEmbed.