Help Test the New WordPress Importer Plugin in Development

The official WordPress Importer plugin is in shambles and has frustrated users with inconsistent performance for years. The plugin has more than a million active installations and is critical for migrations, unless you are familiar with using more advanced tools. With years of unresolved support threads identifying the plugin’s many bugs, the importer is in need of some help.

In a volunteer-driven open source community, important projects like the WordPress importer can go neglected for a long time until someone gets inspired to take on the responsibility. The good news, however, is that the importer is in the process of being completely rewritten thanks to Ryan McCue, who is also a leader on the WP REST API project.

The WordPress Importer Redux project is available on GitHub with fixes for some of the previous plugin’s most troublesome issues. McCue is rewriting the importer with the goals of making it “fast, lightweight, and consistent.” He summarized the major improvements that are part of version 2 in a post on Make/WordPress core blog:

Way less memory usage: Testing shows memory usage to import a 41MB WXR file is down from 132MB to 19MB (less than half the actual file size!). This means no more splitting files just to get them to import.

Faster parser: By using a streaming XML parser, we process data as we go, which is much more scalable than the current approach. Content can begin being imported as soon as the file is read, rather than waiting for pre-processing.

Resumable parsing: By storing more in the database instead of variables, we can quit and resume imports on-the-go.

Partial imports: Rethinking the deduplication approach allows better partial imports, such as when you’re updating a production site from staging.

Better CLI: Treating the CLI as a first-class citizen means a better experience for those doing imports on a daily basis, and better code quality and reusability.

Until recently, the new importer had no UI, so the only way to test it was to run it via WP-CLI. A new Admin UI branch of the project is now available so you can download the plugin as a zip and activate it inside WordPress. McCue tweeted a sneak peak at the progress bar for the import summary:

If you want to test the new importer, McCue encourages users to compare the experience to the old importer and take note of what works and what breaks. Feedback is welcome in the project’s GitHub issues queue on the designated general feedback thread.

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let's discuss your ideas.

This is a ground-up rewrite. Basically, the way that the existing importer works is by reading the whole file in, turning that into a giant object of data, then importing that. (This is XML “push” parsing, because the parser pushes all the data to you at once.)

The rewrite instead works by opening (but not reading) the file, then moving through a piece at a time. (This is XML “pull” parsing, because you specifically pull pieces from the parser as you need.) This means you never actually need the file in memory, just enough to work on. This also means you can pause and resume parsing, as you just need to keep track of where you’re up to.

This uses less memory, because you don’t need the whole file in memory at once (and the usage is also more constant, rather than dependent on file size), as well as being slightly faster (mostly because there’s less memory usage).

The GSoC project tackled this from the UI end, which takes the file and changes how the import runs, but doesn’t change the internals. It’s kind of similar to how splitting WXR files works (IIRC), but doesn’t fix the core issues. The new importer is resumable though, so this should be a lot easier. :)

Also: the running process through the new UI here works differently, in that the browser is responsible for running it via calls to admin-ajax. That’s not a perfect solution, and I do plan on looking into cron running eventually. :)

It’s specifically designed for large imports (that’s mostly what I’m working with), but the UI isn’t ready for those yet. (Specifically: I haven’t finished the resumable parsing functionality that’s needed for large imports via the UI.)

It should definitely work via wp-cli though, as there’s no time limit on that, so it doesn’t need the resumable bits.

Just read this post after pulling out the little hair I have left from countless failed imports. Trying to upload the wptest.io test data to a WP 4.5 installation, either locally with XAMPP or online with my host. Trying this out now and reporting back ASAP with the result. Soooooooooo glad I have found this post and an alternative to the piece of $à!&% that wordpress.org calls an importer. Thank you so so much, you have no idea how glad I am to see a light at the end of the tunnel. I just hope it is not a train coming my way, fingers crossed. Go devs!