Import WordPress xml file larger than 8mb

OPTION 1: If a WordPress WXR file, an XML file exported from WordPress, is too large to import, there are several things you might try to overcome that limit.

  • Increase the amount of memory a PHP script may consume. Note: If using a shared hosting service, you may need to ask your host to increase the limit.

    Increase the memory limit setting in php.ini (e.g. memory_limit = 64M ;). Many hosts may not allow this.

    Increase the memory limit via .htaccess (e.g. php_value memory_limit 64M). Many hosts may not allow this.

    Increase the memory limit via wp-config.php (e.g. define(‘WP_MEMORY_LIMIT’, ’64MB’);)

  • Increase the maximum amount of a time a PHP script will run. Note: If using a shared hosting service, you may need to ask your host to increase the limit.

    Increase the maximum execution time in php.ini (e.g. max_execution_time = 600 ;). Many hosts may not allow this.

  • Increase the PHP upload files size settings. Note: If using a shared hosting service, you may need to ask your host to increase the limit.

    Increase the setting values in php.ini (e.g. upload_max_filesize = 64M ; and post_max_size = 64M ;). Many hosts may not allow this.

    Increase the setting values via .htaccess (e.g. php_value upload_max_filesize 64M and php_value post_max_size = 64M). Many hosts may not allow this.

    Increase the setting values via ini_set lines in wp-config.php. Talk to your host for the correct values.

  • Increase the file upload size limit and/or file upload space limit:

    Login to wp-admin as an administrator.

    In the Site Admin navigation box, click “Options”

    Scroll down and change the settings for “Max upload file size” and/or “Blog upload space”

  • GZip the file. On some hosting services, a gzipped file can be automatically expanded in the background, without WordPress ever knowing the difference. This can allow you to make the file small enough to be fit into the maximum upload size constraints.

    On Windows, use 7Zip to create a gz archive out of the wxr file.

    On Linux, use the gzip command line.

    Make sure that the resulting file has the file extension of “.gz” before uploading it, as this is often necessary.

    This is not guaranteed to work, as it highly depends on the hosting configuration. If this fails, then try another method instead.

  • Break the WordPress WXR file into smaller pieces by separating the data between posts and pasting the header/footer into each file.

As always, before importing the new XML’s, backup the database of the blog you are importing the XML files to and might as well export XML file of that blog as well for good measure.

FYI, this info is available in the Codex.

OPTION 2: It is definitely more robust and probably easier to use the WP Migrate DB Pro (paid) plugin. Despite the name, with an add-on it also imports media files. I have personally encountered situations where none of the above methods worked – the only solution was to to use this plugin.

Leave a Comment