Home Blog Embed A Facebook Comment In WordPress With Shortcode

Embed A Facebook Comment In WordPress With Shortcode


This article will show you how to include a Facebook Embedded Comment into a WordPress post or page with shortcode.

Embedding a comment is one of those features that’s becoming more and more popular – particularly in the news-starved world of traditional media where they’ll often use social posts as an alternative to genuine editorial content. If you’re looking to add social proof or feedback from a conversation, or you would simply like to include the input of others in your own editorials, the Facebook plugin works very well.

The comments plugin will have the effect of increasing engagement with your Facebook post… although it does (at times) compromise on page-load times.

The Result

Here’s a comment of us whinging about Telstra’s crappy ADSL broadband speeds. Shortcode used is [fbcomment url="https://www.facebook.com/beli (snip) 239792483&comment_tracking=%7B%22tn%22%3A%22R%22%7D"].

In this second example I’ll include a single comment I made on Facebook some time ago, and I’ll include the parent comment (note that you can’t include the parent post). Our shortcode uses the additional parameter of parent="1" to include the parent comment.

The Comment Link

To obtain the required comment URL, copy the link associated with the date published below a comment.

Facebook Comment Link

You may optionally click on this link and copy the resulting browser URL to your shortcode.

Shortcode Attributes


The absolute URL of the comment.


The width of the embedded comment container. Min. 220px. Defaults to 560px on desktop. On mobile this parameter is ignored and the width is always 100% (fluid width). Alter as follow: width="400".


Set to true (parent="1") to include the parent comment (if the URL is a reply). You cannot include the parent post.

WordPress Shortcode

Usage of the function requires the Facebook SDK code be copied to your website.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Embedding iFrames

As with most of Facebook’s content, you can simply copy embed code and paste it directly into your post. As with all Facebook features, the comment plugin functionality changes as often as Oprah does drive-through McDonald’s so we’d suggest always using shortcode so you can globally alter all embedded occurrences should the need present itself. That said, if you were to use the iframe option, you would simply copy the code as detailed below.

Facebook Embed Comment

Click embed and Facebook will launch a modal with your embed code. Copy it directly into your WordPress website.

Facebook Embed Code

The iframe option negates the need to have the Facebook SDK code copied to your webiste.



Title: Facebook Comment Plugin WordPress Shortcode
Description: Embed A Facebook Comment In WordPress With Shortcode. Optionally include parent comment.
Download: Shortcode (V0.1) | Plugin Page

■ ■ ■

Interested in WordPress and Web Design? Subscribe to our list and we'll send you subscriber-only tools and plugins

Short URL for this post: http://shor.tt/Jol


Please enter your comment!
Please enter your name here