WordPress 3.1 and Disqus throws Warning: number_format() error in Posts List

After quite a bit digging, I managed to fix it without modifying any WP core files.

Essentially, Disqus usurps the comment count from WordPress and wraps it in its own with unique identifiers. Since WP is calling its own comment count when viewing the Posts lists, it’s getting a string value filled with HTML rather than a plain double value with the comment count. This breaks its internal function number_format_i18n().

The fix is to edit disqus.php and have the function function dsq_comments_number($count) simply return $count. Just delete the extra HTML.

Hopefully Disqus will roll a fix out for this soon, I’ve had problems with how they handle comment counts in the past.

Edit: I just published a full write-up of the fix if you need more explanation: http://www.techerator.com/2011/02/fix-wordpress-3-1-and-disqus-plugin-error-when-returning-comments-count/

Leave a Comment