Jan 112013
 
Share this article...Share on FacebookTweet about this on TwitterShare on Google+Share on RedditShare on LinkedInPin on PinterestShare on StumbleUponShare on TumblrEmail this to someone


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.


Share this article...Share on FacebookTweet about this on TwitterShare on Google+Share on RedditShare on LinkedInPin on PinterestShare on StumbleUponShare on TumblrEmail this to someone
Justin Germino
Working in the IT Industry for over 13 years and specializing in web based technologies. 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!
Apower PlayStation 4 Controller Charging Station: http://t.co/U3gGC6e4KN via @YouTube - 6 mins ago
Justin Germino
Justin Germino

Latest posts by Justin Germino (see all)

  • http://www.benway.net JasonB

    keeping rolling with Disqus, but I still prefer the native wordpress comments :)

    • http://www.dragonblogger.com Justin Germino

      To show you how much I dislike the native WordPress commenting system, I just responded to about 50 comments on a recent article on Basic Blog Tips, I respond to all comments in one sitting, the fact that each reply caused a slow 3-5 second refresh of whole web page when I hit submit, instead of being able to reply to all 50 comments in one smooth flow like I can do with Disqus is why I won’t use default WordPress commenting system. At least not until it becomes dynamic where it doesn’t require refresh of page to leave comment and you can have real time flow of comments/replies updating without refreshing page.

  • Michael Aulia @CravingTech.com

    So far I haven’t found the need or problem in syncing (I’m using W3 Total Cache and Cloudflare). I assume the cached posts/pages are always refreshed at some point on a caching plugin and therefore a sync then should happen?

    I don’t mind if the comments sync are being lagged behind a few days or even a week to my WordPress (since what readers see will be the Disqus’ comments anyway) but I can understand if you have tons of comments a day and something bad happens to Disqus, you’d want to have every latest comment stored on your WordPress database

    • http://www.dragonblogger.com Justin Germino

      It wasn’t bugging me per say, and it was an easy fix. The comments show up right away in Disqus, but knowing I had 2 months worth which is hundreds that weren’t synced I wanted to make sure they were kept at least to within last 24 hours or so.

  • http://kobayo.com/ Takeru

    I had no syncing issues for the past year with w3 total cache, but after changing themes I am starting to have issues. I don’t think w3 total cache would have anything to do with this issue.

    • http://www.dragonblogger.com Justin Germino

      I didn’t think it specifically did, I use Incapsula as well as a cloud protection service which could have been the culprit, or of course it could have been my theme too, or one of my plugins.

      • http://kobayo.com/ Takeru

        I spoke too soon. I just disabled w3 total cache and my comments started to sync again.

        • http://www.dragonblogger.com Justin Germino

          Then this cron job script should work perfectly for you.

    • http://www.dragonblogger.com Justin Germino

      I didn’t think it specifically did, I use Incapsula as well as a cloud protection service which could have been the culprit, or of course it could have been my theme too, or one of my plugins.

  • http://theitbros.com/ Brian Jackson

    We are having the same issues with W3 Total Cache Version 0.9.2.8 and Disqus Comment System Version 2.74 on WordPress version 3.5.1. We followed your instructions, however they didn’t work. I’m curious what versions of the plugins you were on when you wrote this? I see this was published in January… I have a feeling there was a couple updates to Disqus over the last few months.

    Disabling the W3 Total Cache plugin instantly fixes the problem. I am wondering if there has been a new bug introduced? We changed our config file, installed WP-Control and updated the cron job accordingly… tried “Run Now” option, waited a couple hours… no change.

    Curious, are you having any issues currently as of February 24th with this? Thanks for the writeup!

    • http://www.dragonblogger.com Justin Germino

      I always update plugins to most recent the moment they are released, I currently am no longer having this problems. I just checked and have comments that sync this morning on 2/25.
      I am using Disqus plugin Version 2.74 and W3 Total Cache Plugin Version 0.9.2.8 as well.
      Are you using Cloudflare with W3 Total Cache, it could be Cloudflare that caches it?

      • http://theitbros.com/ Brian Jackson

        We aren’t using Cloudflare or any CDN.

        • http://www.dragonblogger.com Justin Germino

          Ok you are still having issues with W3 Total Cache enabled and Disqus comment syncs? Did you open a support case with Disqus? It has been a month since your reply, so lot could have happened between then and now.

  • http://hereiblog.com/ Mark Lamprecht

    I’ve tried what you have listed here to get Disqus to sync, but it will not. Finally, all of the comments imported, but I continue to have to manually sync comments for them to update in the sidebar.

    Any ideas? Thanks.

    • http://www.dragonblogger.com Justin Germino

      Are you using any sort of cache plugin or cloudflare or something of that nature? Cloudflare could be blocking disqus servers from syncing, they need to be whitelisted perhaps.

      • http://hereiblog.com/ Mark Lamprecht

        I don’t use CloudFlare. However, I’ve got Better WP Security and the following plugins to help speed up the site: BWP Minify, DB Cache Reloaded, Hyper Cache, and Combine CSS.

        I just disabled all of the above plugins except the security plugin and ran the cron job. The comments synced so now I have to find the culprit. If it’s hyper cache then I have to figure out which URI to put in the exception box. Fun. :)

        • http://hereiblog.com/ Mark Lamprecht

          Apparently, I was wrong. I cannot get the comments to sync again. The wp-crontrol page says I need to write a hook and add it to the functions.php page. I’m at a loss.

          I guess Disqus will be removed as fast as they were put in place.

        • http://www.dragonblogger.com Justin Germino

          Yep, could be the DB Cache or the HyperCache, hard to say which one but this is something these types of conflicts are common. Good luck.

  • http://telhacast.com/ Thiago Miro

    With the latest update, the Wp-control changed the fields to be filled. How should I fill them now?

    http://wordpress.org/plugins/wp-crontrol/

    • http://www.dragonblogger.com/ Justin Germino

      They actually made it simpler, just set the name and then time in “seconds” like 600 seconds is 10 minute intervals so here is a snapshot of what it should look like now when you add the schedule.

  • comicalpixie

    Is there any way to do the reverse… To import comments INTO Disqus, from WordPress? One of my sites is using a plugin to pull comments from shared posts on social media, but they’re going into the WP database and not picked up by Disqus. I contacted Disqus for help and they said that it’s not supported, but they do have an export-comments.php file in the plugin scripts folder which I could call with a cron job. I’ve wasted a few hours trying to do that with the hosting company I use, with no luck.

    WP-Crontrol has an option to put the php code for the action itself, in a field labeled “Hook code”, and per someone else’s suggestion I tried “wp_remote_get(‘http://simplycomical.com/wp-content/plugins/disqus-comment-system/scripts/export-comments.php’);” – but it’s not working.

    I obviously have no idea what I’m doing… Any suggestions for how to call that file from WP-Crontrol and get it to work? Or some really dumbed down step by step directions for writing a function to call for that?

    Thank you so much for this lovely article! :D

  • http://www.dragonblogger.com/ Justin Germino

    I can’t get access to the code in that php file, however WP-Crontrol needs you to setup a function in functions.php and call that function name in the Cron.

    http://wordpress.org/plugins/wp-crontrol/faq/

    So you would use the information in that article to basically take that export php script, put it as a function in your functions.php and then have WP-Crontrol call that function. I don’t know if WP-Crontrol can actually case execution of external PHP scripts.

    I haven’t run across the scenario before you describe, I have never had a reason to sync comments back to Disqus besides the 1st time it is installed.

  • http://keepupwiththeweb.com Sherryl Perry

    Justin,
    I wanted to let you know that I just found this post through a link on Tim Bonner’s blog. I’m sticking with CommentLuv for now but I’m bookmarking this for the future. This is very valuable info that you’ve shared and I’m sure it will save many bloggers hours of time. Thanks so much for writing it.

    • http://www.dragonblogger.com/ Justin Germino

      Thanks for stopping by, I like both Livefyre and Disqus, though still sticking with Disqus for their revenue sharing and ads potential too for now. For managing comments on multiple sites simultaneously, Disqus has been invaluable.