Getting Disqus to Sync Comments with WordPress



Disqus commenting is the commenting system I switched to back in October 2012 and I had been on Livefyre the entire previous year.  Livefyre was good but the spam comments did start to increase a bit and there were more complaints from users that the commenting widget was loading slow, or had trouble loading on multiple devices plus Livefyre 3 was still never officially released after months of claiming it was coming it appeared to be a disappointment that the new commenting system still had so many bugs it kept getting delayed in it’s release.  Plus Disqus has a much larger network of users and easier guest commenting options so it makes it easier for commenters to have single sign on or leave comments quicker.

disqus2012logo

However, I did have trouble syncing comments between Disqus and WordPress for several weeks until Disqus support reached out and had me try a few things.  One thing to note is that the Disqus folks are pretty responsive, I have had 3-4 separate Disqus support staff contact me over the weeks and they all are courteous and very interested in making sure issues are resolved.  This fix below is recommended for WordPress blogs that use W3 Total Cache, Cloudflare, Incapsula or any other cloud/caching service that stands in front of their sites.  The reason is simple, Disqus uses the WordPress default cron to trigger comment syncs.  However, WordPress cron triggers only if a live hit against your WordPress blog is called.  If people hit cached content/resources then that call is never made to your WordPress database it is served from cache and the cron may never trigger.

To resolve this issue, you simply install 1 WordPress plugin called WP-Crontrol and then configure Disqus commenting to run as a cron job (which just means it runs every set interval) the default is 10 minutes, so comments will always sync to your blog every 10 minutes, you can choose to lower or increase the time but this should be sufficient for most bloggers, the more often you sync the more overhead since it has to run the script.

Update: I updated the instructions for the latest version of WP-Crontrol which makes it even simpler to add recurring cron entries for your WordPress blog.

Fix Disqus Comments Syncing to WordPress

Set Alternate Cron in WordPress

The first thing you are going to need to do is change the WordPress config file to use the Alternate Cron, this tells WordPress to run Cron differently from the default where it triggers on every post update.  You can read more about Alternative Cron for WordPress from the WordPress codex if you want to understand it better.

You will need access to your Web Hosting Panel, so you can edit the wp-config.php file.  This can be done via an FTP client or through any file manager program in your web hosting control panel.

Once you are in your WordPress install directly (the directory above wp-content not inside wp-content) you will see wp-config.php

// Added for Disqus Comment Fix
define(‘ALTERNATE_WP_CRON’, true);

save the file then quit the editor

Install WP-Crontrol

image

The first step is to install the WP-Crontrol plugin, after it is installed then activate it.

Then go under your Tools –> Crontrol settings.

image

Check and see if you have an entry for dsq_sync_forum

cron-schedules

If you don’t have this entry (you won’t if you never set it up in most cases) then you will need to add it manually.  To do this just enter the following at the bottom of the WP-Crontrol configuration.

cron-disqus

 

Click Add Cron Entry, and this will simply trigger it to happen right away, it will stay auto running every 10 minutes from the Disqus Comment Sync function.

Now just give it about 15 minutes tops, and all of your comments should sync and any new comments should sync every 15 minutes.  The easiest way to confirm is to watch your Comment Dashboard and remember the comment numbers.

image

Also you can click on Approved, and make sure your latest approved comments are the date/time stamp from the last time you received a comment or at least the same day if you get comment daily, if you don’t get comments every day you should know when last comment was to confirm it did sync properly.

image

This is how you fix the Disqus Comment sync issue with WordPress when you are using cloud and caching services like Incapsula, Cloudflare, W3 Total Cache and such so that your comments sync even if the cache is hit on your blog and no new WP calls are actually made properly.

Justin Germino
Working in the IT Industry for over 17 years starting with OS, Networking and then moving into web based technologies including authentication and online security. Dragon Blogger has unique insights and opinions to how the internet and web technology works. An Avid movie fan, video game fan and fan of trying anything and everything new.
Justin Germino

@dragonblogger

Technology, Gaming and Wordpress blogger who runs gadget giveaways, helps others with blogging tips, monetization, earning and more!
Try running giveaways on Gleam.io platform https://t.co/7CAxD8xET6 the interface is great and some unique entry options! - 23 mins ago
Justin Germino
Justin Germino

Latest posts by Justin Germino (see all)

2013-09-03T09:41:44+00:00 January 11th, 2013|Categories: blogging|Tags: , , , |