Templates by BIGtheme NET

Fix: Facebook Post Embed not Working on WordPress

Sometimes around March, embedded Facebook posts stopped working correctly on WordPress. This doesn’t seem to affect WordPress alone, it seems to affect other platforms as well. A lot of people speculated it was because Facebook changed certain things in their API but embeds included on web pages before March still appears correctly. Till now, the issue remains the same and post embeds appear as a hyperlinked text.
There’s a small fix though and it’s pretty easy. For embeds to work correctly, a snippet of JavaScript including Facebook SDK has to be placed in your site’s head section.
1. If you’re using Genesis, you can easily go to Genesis > Theme Settings > Header and Footer Script and paste the code in the head section. Using a different WP theme, you can get Header and Footer plugin to implement the code.
window.fbAsyncInit = function() {
xfbml : true,
version : ‘v2.3’
}; (function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/en_US/sdk.js”;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));
3. And paste it in the site’s head section.
This is all I did that fixed the issue. Putting the code in your footer probably won’t work correctly, it has to be in the head section.

Leave a Reply

Your email address will not be published. Required fields are marked *