How to Embed Facebook Videos in WordPress

How to Embed Facebook Videos in WordPress

The decision to embed Facebook videos in WordPress is a welcome one. This is thanks to the gain in popularity of Facebook videos and Facebook Live platform. The good news is that it is possible to embed the Facebook videos in your website. The purpose of this post is to educate you on how to do that.

The first reason why you should embed Facebook videos in WordPress is for the sake of your website’s speed. You may have read or heard more than once that you should avoid uploading videos directly to your WordPress website. Instead, you should embed videos from video sharing sites like YouTube. This is because each video you upload to your website will cause your page to be heavier and that will impact the load speed. Yes YouTube is the largest video sharing site but Facebook is the biggest social network. Being able to embed your Facebook videos will save you time that would otherwise have been spent uploading the same video to YouTube then embedding it to your site. Here is how you can embed Facebook videos.

Embedding Facebook videos
The first step is obviously to locate the video you wish to embed. Right click on the video date or name and select ‘copy link address’. Thereafter, visit Facebook embedded video player from developers.facebook.com and go to the code generator section. Paste the copied URL into the ‘URL of video’ field. Click on the get code button for a popup showing two boxes of code.

The first part of the code will go to the header section of your website. You can add this to the theme or the child theme by editing the .php file then pasting the code after the <body> tag. Alternatively, you can install the Insert Headers and Footers plugin. Go to settings>>Insert Headers and Footers page from the admin area and paste the copied code into the footer box. Save the changes. The first part of the code only needs to be added once to your website. When you want to embed Facebook videos in WordPress later on, you only paste the second part.

After copying the second part of the code, add it to your WordPress post, pages or the sidebar widget. Make sure you add it using the ‘Text editor’ interface. After that, you can visit your page to watch the embedded Facebook video.

Embedding Facebook live
Embedding the Facebook live video is similar save for how you get the code. To broadcast both on Facebook and your website, you have to go live first. After that, right click on the date and copy link address to get the URL of the live video. Go to Facebook embedded video player and paste the link in the ‘URL of video’ field. A preview of the video will be displayed. Click on Get Code button and follow the instructions of embedding a Facebook video described above.

Embed Facebook videos in WordPress