WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to import a xml file (from a previous wordpress theme) into a new wordpress theme. The problem is that the xml file is 46mb much bigger than the wordpress 8mb limit. Anyone have any advice/recommendations on how to import this file?



share|improve this question

migrated from stackoverflow.com Sep 5 '13 at 15:19

This question came from our site for professional and enthusiast programmers.

If you have command line access, you could try WP_CLI. – Welcher Dec 23 '14 at 11:46

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.

share|improve this answer

if you have access to the .htaccess file in your www folder. Just include the following 2 lines in .htaccess:

php_value upload_max_filesize 50M
php_value post_max_size 50M

Other way .. you can place this piece of code in your theme's functions.php file

@ini_set( 'upload_max_size' , '50M' );
@ini_set( 'post_max_size', '50M');
share|improve this answer
.. Temporarily. Once you've done the import, you should probably restore the default maximums. – Thomas W Aug 27 '13 at 9:06
I don't have access to the .htaccess file the second suggestion seems achievable. Should it be placed anywhere particular in the functions.php file? – apagey Aug 27 '13 at 9:10
yap try it and tell if it did help . – pr1nc3 Aug 27 '13 at 9:11
Unfortunately @ini_set( 'upload_max_size' , '50M' ); @ini_set( 'post_max_size', '50M'); doesn't work it returns a server error. Any other suggestions? Surely someone has come across this before. – apagey Aug 27 '13 at 12:28
do you have access to php.ini file ? – pr1nc3 Aug 27 '13 at 12:37

According to the codex, you should be able to split the XML file into pieces and import them separately. Here is how I would do it.

The WordPress XML export file is in a format they call WordPress eXtended RSS (WXR), and looks like this (some lines left out):

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"

    <!-- several tags about your blog, including title, link, description, etc. -->

    <wp:author><!-- a list of your post authors here --></wp:author>

    <wp:category><!-- a list of your categories --></wp:category>
    <wp:tag><!-- first tag info --></wp:tag>
    <wp:tag><!-- second tag info, etc. --></wp:tag>


        <!-- first blog post here -->

        <!-- second blog post here, etc. -->

You'll need to split this into at least 6 different files to stay under your 8MB limit. Copy the file until you have 6 or 7 copies of the file. Then in each copy, remove some of the <item> elements (posts) until you are under 8MB. So each file will have identical information in the first part of the file, and will only differ in the <item> section. Make sure you don't include the same post in more than one file, or it will get imported twice. Then import each file, one at a time.

share|improve this answer

There's a application you can download to split large XML/WXR files into smaller files

Or you can change the upload & post limits in your php.ini file in cPanel.

share|improve this answer

This is the solution..... hope you will enjoy

You can change that setting by making a simple text file and putting it into the wp-admin folder.

So to make this file all you have to do is open a simple text program like textedit on Mac or notepad on Windows and type these two lines of code.

upload_max_filesize = 64M;
post_max_size = 32M;

You can put in any value you want I just chose 64 and 32 because they seemed like good numbers. So now you just save the file and name it php.ini the program will ask you if you want to use the .ini extension, click use .ini and save. Now all that is left to do is upload the file to your server and place it in the "wp-admin" folder, anywhere in the root section of the folder is fine.

Now login to your WordPress control panel and try and upload something large. It shouldn't give you any problems and upload whatever you want!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.