WordPress Importer showing blank page after clicking the Upload File and Import button

After turning on the error display in WordPress, by setting:

define('WP_DEBUG', false);

to:

define('WP_DEBUG', true);

While importing I was able to get the following error:

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

Solution that worked for me:

Replace in file parsers.php in plugin wordpress-importer at Class WXR_Parser_SimpleXML

$dom = new DOMDocument;
$old_value = null;
if ( function_exists( 'libxml_disable_entity_loader' ) ) {
$old_value = libxml_disable_entity_loader( true );
}
$success = $dom->loadXML( file_get_contents( $file ) );
if ( ! is_null( $old_value ) ) {
libxml_disable_entity_loader( $old_value );
}

if ( ! $success || isset( $dom->doctype ) ) {
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
}

$xml = simplexml_import_dom( $dom );
unset( $dom );

With:

$xml = simplexml_load_file($file);

Zie ook hier en hier.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *