disqus wordpress

Error with import, Disqus and WordPress
XML syntax error: attributes construct error

Learn to fix importing a WordPress Export XML document to import.disqus.com, which fails with an XML syntax error.

Reading time of 263 words
1 minute
Reading time of 263 words ~ 1 minute


Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee

Importing my WordPress Export XML document to import.disqus.com fails with the unhelpful error.

XML syntax error: attributes construct error, line 21, column 66 (line 21)

I previously hosted this blog using the excellent service provided by WordPress but migrated to Hugo for reasons mentioned here. My WordPress blog had hundreds of comments I wanted to relocate quickly, so I used Disqus and the WordPress export feature.

Whenever I attempted to import the large, exported XML file, it failed with a cryptic parsing error. XML is extremely strict with its syntax and often demands a lot of boilerplate work, so many developers moved on to JSON, TOML, and YAML.

disqus import xml syntax error
Disqus import failure

The problem is that the exported WordPress XML is valid but breaks the Disqus importer. My solution invalidated the file by removing the <rss> elements and moving its namespaces to <channel>.

Your exported XML file may be huge, so you should use a suitable text editor with built-in XML syntax highlighting, such as Notepad++ for Windows.


The original XML fails to import.

<?xml version="1.0" encoding="UTF-8"?>
<!--
 This is a WordPress eXtended RSS file generated by WordPress as an export of your site.
 ...
-->
<!-- generator="WordPress.com" created="2022-08-05 04:44"-->
<rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/">
  <channel>...</channel>
</rss>

The modified XML that worked for me, note I deleted <rss></rss> and moved all the xmlns attributes to <channel>.

<?xml version="1.0" encoding="UTF-8"?>
<!--
 This is a WordPress eXtended RSS file generated by WordPress as an export of your site.
 ...
-->
<!-- generator="WordPress.com" created="2022-08-05 04:44"-->
<channel xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:wp="http://wordpress.org/export/1.2/">...</channel>
disqus import success
Disqus import is successful!

Written by Ben Garrett

Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee