Import Facebook Comments to Wordpress in 2020

Convert embedded Facebook comments to native Wordpress comments.

It was previously possible to install a Wordpress plugin, connect a Facebook developer account, and then click a button to import comments from Facebook directly into Wordpress.

In 2020, this process is no longer as simple as installing a Facebook-to-Wordpress importing plugin. When our client wanted to transition a video subscription website from using Facebook embedded comments to Wordpress comments, we had to develop our own solution with the following feature requirements:

Features

  • Create Wordpress comments based on each Facebook comment
  • Map comments to the Wordpress pages they were originally embedded on
  • Associate imported comments with existing Wordpress users
  • Maintain threaded responses
  • Persist the like count and comment moderation status

Our approach had to also accomodate a large amount of data and an active user base. Here was the end result of our importing efforts:

Import stats

  • 470 posts with comment feeds
  • 12,871 approved comments
  • 706 unapproved (hidden) comments
  • 6,216 top level comments
  • 6,655 nested comments
  • Thousands of “likes”
  • Thousands of Facebook users associated with Wordpress user accounts

Standard Embedded Comments Setup

Some Wordpress websites start out by embedding social comments into each page. Wordpress plugins like WpDevArt Facebook Comments simplify this process.

Comment moderation takes place directly on Facebook and a moderation page exists for each embedded commenting feed. This means there’s a Facebook moderation page for each individual Wordpress post.

Why Switch from Facebook to Native Wordpress Comments?

Data ownership

Data ownership is one of the main reasons people migrate away from embedded social comments on Wordpress. At any point, Facebook might decide to ban your user account or business page, which will cause you to lose valuable data that took time and effort to accumulate.

Search Engine Optimization

Embedded facebook comments aren’t SEO friendly because they are embedded via an iFrame, which isn’t visible to the Google crawler. It’s common for a comment to contain a question that people might search for on Google. As a result, native Wordpress comments expand the potential set of queries your page might rank for.

Facebook login

If you’re migrating away from using Facebook as the primary sign on option, you need a commenting solution that doesn’t require Facebook login to work.

How to migrate from Facebook to Native Wordpress comments

Why aren’t there any Wordpress plugins?

If you’ve searched for Wordpress plugins that import and convert Facebook comments into native Wordpress comments, you might be surprised to not find any solutions. Actually, some solutions used to exist, but these plugins no longer work. If you visit these plugin pages, you’ll see a notice stating they were removed.

Basically, there is no standard Wordpress plugin that can do this. This is primarily because Facebook has made it too difficult to create a standard, one-size-fits-all solution.

Using Graph API to import comments

Importing comments from Facebook requires the use of the Graph API. The API Explorer can be used for testing.

Getting the Facebook Object IDs

In order to retrieve a Facebook comment feed for a specific Wordpress post, the API endpoint must include the associated Facebook feed’s Object ID. This Object ID is unique for each Wordpress post containing an embedded feed.

Retrieving a list of Object IDs and mapping them to the correct post_id is not possible using any standard methods. For example, you can’t retrieve a list of Object IDs with any identifying Wordpress post information, like the post name, post slug, etc. You have to know the Facebook Object ID first and then use your own methods for associating it with the correct post.

In order to do this, you will likely have to scrape your own website to extract this information.

Accounting for Rate Limiting

Facebook limits the number of API requests that can be performed in a short period of time. Unfortunately, rate limiting can occur when paginating comments and performing various lookup requests. Any commenting data retrieved from a request should be cached so that progress isn’t lost when not rate limited anymore.

Each API request has a limited number of entries, so pagination must be used, which requires more requests. Requests might get blocked during pagination, so it’s possible to miss commenting entries if these cases aren’t accounted for.

In our case, we had to retrieve comments from over 500 pages - 12,000+ comments in total!

Available Data and Permissions

Facebook constantly updates it’s API and deprecates API versions. With each version, it seems like more limitations are put into place. In many cases, the data returned from an API request is limited based on your app’s permissions. It’s likely that you will have to request additional permissions and this process might require manual review from Facebook.

Associating Facebook users with Wordpress users

With standard API requests, limited commenter data is returned. For standard permissions, the only information about the user is the full name and the Facebook commenter ID. This information can be used to associate Wordpress profile ids and then use the Wordpress function wp_insert_comment( array $commentdata ) to create the comment.

Managed Importing

Need help importing Facebook comments directly into Wordpress? Contact us.

Written by Ben Bozzay