Want to fix WordPress export comments errors, and problems in Disqus import? Are you unable to replace Disqus Comments with your WordPress comments? We switched WordPress Comments to Disqus comments, which are live right now and would like to share with you some errors which we fixed along the way. The purpose of this post is that if you have experienced similar errors, these tips should help you fix it.
First you need to install the Disqus Plugin. You need to simply export your WordPress comments to Disqus comments, and it will sync automatically later between the two commenting systems.
WordPress Comments Export Errors
I understood that maybe the error was because the comment export file would be very huge as we intended to export nearly 30,000 comments! Maybe there was a better and more reliable way to export comments to Disqus.
WXR File Export Errors
The next best way to export comments from your WordPress blog to Disqus comments was to use the WordPress export feature to create a WordPress eXtended RSS orÂ WXR file, which could then be uploaded to Disqus. Go to WordPress Admin> Tools> Export. Choose to export all posts easily.
But the WordPress export feature did not work as smoothly as expected. We downloaded the file and uploaded it to Disqus import, but the file would simply not import stating that it had errors.Â We checked at the bottom of exported file and found the following error
The file creation timed out before the full file was created at 18MB.Â We checked that WordPress only allowed maximum file execution time for 30 seconds everytime. There was a need to increase the PHP script execution time that WordPress would allow to let us create the WordPress export WXR file.
So we added the following code to the wp-config.php file in the WordPress installation folder. This increased the execution time for generation of this WordPress export file to 60 seconds. You can increase the time further if your scripts are still timing out.
This is a very important file which contains your important database information and passwords. Now the script was able to completely execute and we were able to successfully create the WordPress export file at over 40MB.
WXR file code errors
Now you need to upload this WXR file in theÂ Disqus comment import system.
Though the comments file uploaded successfully,Â Disqus was still unable to process the file pending some errors.Â The file showed the following XML syntax errors this time
After 24 hours whenÂ Disqus was still unable to process the file be contacted DisqusÂ support, and advised that the error occurs due to XML-invalid UTF-8 characters in the file. After fixing these errors, users are advised to re-import the files.
Specifically, it is the first character (i.e., the first byte) in that list of four bytes that is the culprit. Although this character is a valid UTF-8 character, it is XML-invalid. In other words it cannot be used in XML files.
How to find the invalid characters?
Disqus support gave some very useful advice without which it was not possible to fix this file anyway. We had uploaded this file onto our server, and we logged on using Putty to run the grep code on this xml file. grep is a command-line utility for searching data for matching a regular expression.
grep --color='auto' -P -n "[x00-x08]" file.xml
grep --color='auto' -P -n "[x10-x1f]" file.xml
And we were able to find the offending error which was causing the problem.
So we searched for the comment on WordPress, deleted the comment (someone had used short code in the comment), and re-exported the WordPress comment file and this time it should upload successfully and get processed hopefully.
Â Imported comments error
Though the file uploaded successfully, the panel stated that the comment file processing time was around 24 hours. In a few hours the comments started going online and we enabled theÂ Disqus comments from the WordPress admin panel, which automatically replaced our previous WordPress comments system. However, some comments errors still persisted …
… and Disqus was able to to provide a detailed report on all the comments that failed to be imported. We searched for those comments in WordPress and deleted them as the all contained form of strange code.
I hope that if you are experiencing similar errors in your Disqus commends installation, you would be able to fix them easily now. Â Now you can try out the Disqus comment system live on the site right now. There is no doubt that Disqus provides an amazing commenting Â system to increased interaction of your website community.