Importing large XML files in WordPress can be a pain. Fortunately, there is a great tool, WXR Splitter, that allows you to split a cumbersome XML file, and import multiple smaller files.
Why might you need to split your XML files in the first place? When migrating a site from staging to live deployment (or vice versa), I normally use a plugin like Duplicator, WordPress Move, WP Clone or BackupBuddy. For 99% of websites, this works smoothly.
Every so often, site migration via these plugins won’t be a smooth process. Usually this occurs when you are moving a larger than normal blog or e-commerce site — several thousands of pages deep — and the destination server has timeout limits set that cannot be overridden easily. Most servers have a time limit that background processes (like installing a clone of a huge site) are allowed to run. In this scenario, What might you do?
If you suspect you’re going to be in this situation at all, you should do a test migration to a dummy site before the big day. This will inform you of any upcoming calamities to avoid. If the normal migration plugins are not going to work, you’ll need to do a few things. First: take an inventory of everything that will have to be moved. Figure out where you are going to store these for quick deployment. These should include your theme files; uploads folder; XML files (we will get to this shortly); and all the Settings for your theme, including menus, theme options, and widgets. Theme files and uploads can be migrated via FTP in these special cases, XML files can be both exported from staging and imported to deployment via the WordPress Importer. But with a gargantuan site, one or more of the XML files will surely be too large to import in its natural form. The WordPress Import plugin will not let you import an XML file larger than 8MB. (Until recently, you could only import 2MB or less with this plugin.)
This is where WXR Splitter comes in. Version 1.52 of WXR Splitter runs on Windows 7, Vista, or XP with .NET 2.0 installed. Simply choose the file you want to split into chunks and how large you would like your chunk files to be. Moments later, your XML files are ready for importing.
If your normal site migration workflow is thwarted, what is your backup plan? I’d love to hear about it in the comments below.