Facebook Comments for WordPress

20 April 2011

= 8:24AM (GMT) =
I just released 3.1.1, which adds a dark style option for dark sites for users of v2 comment system, and also fixes a bug. This latter should fix the slowness some people were experiencing.

17 April 2011

= 6:43AM (GMT) =
  • A user has posted a short troubleshooting guide. Check it out if you're having issues. And you can always delete/reinstall the plugin if nothing else is working (or your XID is missing).
  • Email notifications should be working in this coming, or the following, update. Currently they only work with v1.
  • The new dark color scheme will be added in the next update
  • Current facebook bugs with comment system here.

08 April 2011

= 9:03PM (GMT) =
Things should be working again. Let me know here or on twitter if they're not.

Also, if you have a problem and need help, please check here before asking me.

07 April 2011

= 10:35PM (GMT) =
Hi. Facebook's all.js script is broken, which seems to be what's causing the problems among those of you using "new" or "v1 only". If Facebook doesn't have it fixed in the next day or so, I'll release an update which uses a patched version of the script.

14 March 2011

= 12:46am (GMT) =
3.1 is out, it will propagate within 15 minutes. This took over thirty coding/debugging hours, so unless there are bugs, there probably won't be any more releases until April.
Here is an overview of what's changed (from the readme):
  • Important: I highly recommend using "v2 only", as it is, by far, the most feature-filled. If you have old comments, you can use "Display both v1 and v2 comments"
  • Issue: If you see Warning: http://example.com/example_post is unreachable., make sure your app settings are correct (enter http://example.com/ for "Site URL" and example.com for "Site Domain", note the lack of http or a trailing slash, this is important)
  • Feature: Like button integrated into plugin. Enable on settings page. You can fully customize it there as well.
  • Feature: Like button can also be added to the top or bottom of each post on the site's main page (same "like" count as the one in comments)
  • Feature: Comment count for 'v2 only' comments now displayed. Customizable on plugin's settings page.
  • Settings: Reorganized settings page to make clear what applies to which version of facebook comment system
  • Bugfix: Users should no longer see "Fatal error: Cannot use object of type WP_Error as array in wp-content/plugins/facebook-comments-for-wordpress/facebook-comments-admin.php on line 71"
  • Bugfix: "Comments Closed" should no longer display inappropriately
  • Bugfix: The 'delete' link on the dashboard recent comments widget is functional again
  • Bugfix: A request to facebook that times out no longer incorrectly asserts that the application ID is incorrect
  • Bugfix: No longer dies if facebook is unreachable (i.e., no more "Uncaught CurlException: 6: [...] name lookup timed out thrown on line 622")
  • Bugfix: ...and no more "Uncaught CurlException: 1: [...] thrown on line 519"
  • Bugfix: Activation should no longer be slow on sites with many comments
  • Bugfix: Other small edge case bug fixes

Things Facebook changed with v2

(facebook post, my summary)
A brief rundown:
  • You may have problems if using Firefox less than 4, or pretty much any version of IE except for IE9
  • No more custom CSS or darksite
    "We want to make the Comments plugin consistent with the others, so we will most likely have a dark styled version, ability to specify font, etc., but unfortunately, not have custom css." - Cat Lee, Program Manager, Developer Relations at Facebook
  • No more anonymous comments

If anyone would like to contribute to the plugin, you can do so by forking the project on GitHub and letting me know when you'd like an update pushed to WordPress.

If you discover a bug, please add it to the GitHub Issues page. You can always find help by posting in the Live Demo below or by leaving a message in the WordPress forums.

If the latest version isn't working for you, you can download a previous version here (v1.5.2 worked for nearly everyone, but lacks combined comment counts and notifications).

What Is It?↑Top

It's a Way to Enable Your Visitors
People get frustrated each and every time they're required to give their name and email to a website. After installing this simple plugin, your readers can interact with your site using their Facebook (or Yahoo!) account.

» Post comments using your Facebook name and photo
» Set the number of comments you want to display
» Style the comment box to match your site's theme
» Receive notifications when new comments are posted

Live Demo↑Top

Facebook comments:

Usage Screenshots↑Top

1. If you don't set a Facebook application ID, the following will appear in your comments (if you're an admin). 2. This is the Facebook comments box, complete with comments. 3. This is the anonymous posting form that non-Facebook users see. 4. This is the comments box with the Reverse option enabled. 5. This is the comments box using an external stylesheet (for dark sites). 6. This is the comments box with the Remove grey box option enabled. 7. Clicking the Administer Comments link allows you to block specific users from commenting.

Upcoming Features↑Top

Option to allow the Facebook comments box to be included before or after the WordPress comments Ability to import Facebook comments into the WordPress database and vice-versa Option to specify an image to be used in the link that's generated on Facebook when the Like button is clicked Option to link to a landing page instead of to the post a comment was made on

Known Issues↑Top

After deleting a comment, all Delete links disappear (Facebook bug; try refreshing the page) New comments may take a few minutes to show up (Facebook bug due to latency on their servers)

Frequently Asked Questions↑Top

My comments aren't showing up. All I see is the Facebook comments title.

This plugin currently conflicts with the following Facebook-related plugins:

This is because this plugin loads Facebook's new JavaScript library while other plugins load the old library. On pages where both libraries are loaded, only the first plugin will work properly. (The authors of the aforementioned plugins need to update their code.)

Please disable these plugins to see if they're conflicting before emailing me. Their implementation is beyond my control.

The comments aren't showing up on my pages/posts at all (not even the Facebook comments title).

The Facebook comments attach themselves to the default WordPress comments, so you need to enable commenting on your pages and posts for this plugin to work.

You can hide the default WordPress comments afterwards by checking the Hide WordPress comments on posts/pages where Facebook commenting is enabled option on the plugin's settings page.

I receive a syntax/fatal error when I activate the plugin.

If you receive either of the following errors, please contact your webhost and ask them to upgrade their servers to the latest version of PHP:

If you receive the following error, please ask your webhost to install the PHP cURL extension (a common PHP library for communicating with other websites):

Combined comment counts aren't working on my site.

Ensure your application secret is set correctly. If it's not, all Facebook API calls will return an error and the plugin won't be able to retrieve the proper counts.

If you're sure your application secret is correct, note that the combined comment count is passed through WordPress' get_comments_number() function.

If you're using a custom theme, you may have to modify your comments.php file (located inside your theme's directory) to include a call to get_comments_number() where your comments are being listed.

I'm seeing a Facebook error page in the iframe instead of my comments.

This generally happens due to an issue loading Facebook's JavaScript library. You can attempt to remedy this issue by loading the library the old way. This can be done by checking The old way option on the plugin's settings page.

Can I see the names and profile pictures of the people who Like a post?

Facebook only allows you to see the names and pictures of people that you're friends with.

If 100 people Like your post, but only 5 of them are your friends, you'll only see the names and pictures of those 5 people. The others will appear as "...and 95 others like this."

I don't see the anonymous posting form when I'm not logged into Facebook.

You can enable anonymous comments as follows:

How do I add a margin around the comments?

Add the following to your Container Styles on the settings page: margin: 20px;

Why aren't all of the profile pics under the Like button displayed?

Facebook only displays profile pics for people with whom you're friends.

I'm receiving a Database Down error when I try to post a new comment. How do I fix this?

Try disabling any other Facebook-related plugins running on your site. They often cause conflicts that disrupt the communication between the comments and Facebook's servers.

How do I manually insert the Facebook comments in my theme?

Simply add the following code where you'd like the comments to show up: <?php if (function_exists('facebook_comments')) facebook_comments(); ?>

Note that you'll still need a valid Facebook application ID and a unique XID for the comments to show up. Also, since the post ID is appended to the XID, the comments will still be unique for each page (so you can't use them as a shoutbox in your sidebar).

Can I have the Facebook comments show up after the WordPress comments?

What's an XID and why do I need one?

Every set of Facebook comments requires a unique XID so Facebook can keep track of which comments belong to which pages. This plugin takes your XID (which was randomly generated when you activated the plugin) and appends _post<postId> to it, thereby ensuring a unique XID for each post.

XIDs are maintained when you upgrade this plugin.

Note that if you change the post ID manually, your Facebook comments will no longer show up because for that particular post because that also causes your XID to change.

The Hide WordPress comments feature isn't working.

Certain themes may name the <div> element containing the WordPress comments differently. This plugin simply uses CSS to hide the following <div> elements:

If your WordPress comments aren't being hidden, you may need to add a new ID or class to <plugin_dir>/css/facebook-comments-hidewpcomments.css file.

The comments aren't appearing in Internet Explorer (but they work in other browsers).

Ensure the Include Facebook FBML reference and Include OpenGraph reference options are checked off on the settings page.

If the comments still aren't appearing in IE, open up your theme's header.php file and add the following attributes to the <html> tag: xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"

Can I send users to a landing page instead of to the page a comment was made on?

This feature has been requested a few times and will show up in a future release.

Can I share comment streams between my Facebook fanpage and my WordPress blog?

This feature has been requested several times but hasn't been implemented yet. (You can try the WordBooker plugin if you need this functionality.)

Why do my comments take a few seconds to show up?

The Facebook comments widget has to query Facebook's servers to retrieve the appropriate comments. This can take up to 10 seconds. IF they still haven't shown up after that time, refresh the page.

The issues below have all been resolved in the most current version of this plugin. I leave them here for posterity.

Can I display the comments on my homepage?

While some people have claimed success in this endeavor, it is not a currently supported feature of the plugin. I may add this functionality at a later time.

How can I resolve conflicts with the Facebook Like and Share buttons?

There are a few steps you can take to remedy these issues.

First, check if your page is including the following script more than once:

  • <script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>

If so, you'll need to manually remove the offending inclusion (either from your single.php file, your page.php or one of your plugins). Ensure you keep the inclusion that's attached to this plugin. It shows up in the following format:

  • <script src="http://connect.facebook.net/en_US/all.js#appId=<your_app_id>&xfbml=1" type="text/javascript"></script>

If that doesn't remedy the conflict, look for the following script on your page and remove it:

  • <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

If this causes your Facebook Like or Share button to stop working, you'll need to update your code as follows:

  • Change this: <a name="fb_share" type="box_count" share_url="<your_webpage>" href="http://www.facebook.com/sharer.php">Share</a>
  • ...to this: <fb:like-box href="<your_webpage>" width="200" connections="6" stream="true" header="false"></fb:like-box>

You can read more about the proper way to include Facebook Like and Share buttons on the Facebook Developer website.

How to Install and Setup↑Top

1. Download the plugin and unzip it to <wordpress>/wp-content/plugins/. 2. From your WordPress Dashboard, go to the Plugins section. 3. Find the Facebook Comments for WordPress row and click the Activate link.

Depending on the number of posts on your site, activation may take a moment because the plugin is caching all of your comment counts.

4. Add the Facebook Developer application to your Facebook account. 5. Click the + Set Up New App button. 6. Enter an Application Name (the name of your website) and agree to the terms. 7. Click on the Website tab and copy the Application ID and Application Secret from the Settings page. 8. From your WordPress Dashboard, go to the Facebook Comments section under Settings. 9. Enter your Facebook application ID and application secret in the first two textboxes. Adjust options if needed.

How to Remove↑Top

1. From your WordPress Dashboard, go to the Plugins section. 2. Find the Facebook Comments for WordPress row and click the Deactivate link.

Contact the Author↑Top

If you're looking for help, you can try posting in the Live Demo above or leave a message in the WordPress forums. Should you discover a bug, please add it to the GitHub Issues page.

If you need to get in touch with me, you can always find me on Twitter, or email fbc _at_ we8uDOTcom.

If you want to, you can donate here:↑Top