Fix WordPress Import Posts Not Working Issue
Fix WordPress Import Posts Not Working Issue

Recently I was working on one project in which I wanted to export posts from one instance and import into another wordpress instance. It was a RHEL server and some basic php related softwares were installed. But when I tried to import posts into this wordpress instance then I was not able to import posts.

I started debugging and found following error in log

PHP Fatal error: Class ‘DOMDocument’ not found in /var/www/html/wp-content/plugins/wordpress-importer/parsers.php on line 61

How to Fix WordPress Import Issue ?

If wordpress import is not working and showing above error then probably your linux server doesn’t have php-dom installed. Php-dom extension for parsing dom.

I was using RHEL (Red Hat Enterprise Linux) server. To install “php-dom” in RHEL you can use following command

yum install php-dom

The above command may vary as per your linux distribution you are using.

If you are using another version of linux and not able to import posts into wordpress then let me know which command did you use.