Import WordPress xml file larger than 8mb

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?

Thanks

Read More

apagey

Related posts

10 comments

  1. 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.

  2. 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');
    
  3. 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"
    >
    
    <channel>
        <!-- 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>
    
        <generator>http://wordpress.org/?v=3.6</generator>
    
        <item>
            <!-- first blog post here -->
        </item>
    
        <item>
            <!-- second blog post here, etc. -->
        </item>
    </channel>
    

    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.

  4. 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!

  5. all you need is this plugin

    Increase Max Upload Filesize

    Download and install from wordpress.org

    enter the value (up to 250mb) in bytes, and enjoy.

    However, if you are uploading a large file, you may need to have installed memory bump plugin or increasse execution time manually

  6. If it’s available to you, WP-CLI offers an import command which is inarguably the best way to import large WXR files. It also offers an export command which allows you to export WXR files and it will split them into the file size you specify.

  7. I tried this method by Gaia and it worked no problem thanks Gia

    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.

  8. I’ve always found the simplest way is be editing the user.ini file in the root of the WP installation, or adding one.

    Plugins like WordFence and others that need to operate on system settings, will often do that because it plays nice with WordPress and several systems.

    Edit or create a user.ini file in the WP root directory, copy/paste the code below, and save it. If you’re using any kind of caching, flush them, then refresh the page you’re uploading on.

    In my WP installation the memory is set to 64M and I limited file sizes to 5M.
    Change both upload_max_filesize and post_max_size to something larger than the file you’re uploading.

    ; Memory and file sizes
    memory_limit = 64M
    upload_max_filesize = 5M
    post_max_size = 5M
    file_uploads = On
    max_execution_time = 300
    ; End Upload Restrictions
    
  9. I tried wpcli as it’s command line , many things are handled at their end as well.

    My XML file size was approx 10 MB.

    In wp-config.php

    set_time_limit( 86400 );
    define('WP_CACHE', false);
    define('WP_MEMORY_LIMIT', '1G');
    define('WP_MAX_MEMORY_LIMIT', '1G');
    

    Example of wpcli

    $ wp import example.wordpress.2016-06-21.xml --authors=skip
    

Comments are closed.