rich menga books gear search about contact

wordpress export troubles

Situation: I want to move my blog back to And yes, I seriously want to do this. After thinking about it lot, I was most comfortable having my blog at that domain; it just feels like the right thing to do.

Bonus: I have a way of moving the blog where it would redirect everything easily. I already know how to do this and no one would "lose" anything. I tested a redirect setup, and with a little PHP magic it all works.

So what's the problem?

Well there's no other way than to describe it in super-nerdy fashion, so here goes.

The plan was to do this:

  1. Export everything as a single WXR file.
  2. Import everything to a new WordPress blog on
  3. Reinstall all plugins.
  4. Import the template.
  5. Set up the redirect.

And yeah, it was supposed to be that easy.

The snag I encountered is that the new WordPress absolutely will not import everything from the WXR and I have no idea why. The import process gets "stuck" at a certain point and will not complete.

Things I've tried:

  1. Inspect the WXR manually in a text editor. Everything checks out. There's nothing wrong with it.
  2. Try the import process again. Didn't work. It keeps "sticking" at the same spot.

For the life of me I absolutely cannot figure out what is going on with it.

In the end what I'll have to do is "break up" the WXR file. The file is roughly 5.5MB in size which is well under the 8MB import limit in WP, but even so I'll have to manually split the file.

In short, this is going to be a pain in the ass.

Quick questions answered (because I know some WP authors/admins would ask these):

Q: Why not just manually export the MySQL database and import to a new one?

A: I could do that. The problem is that there's a bunch of crap in there pointing to the old domain. In addition there are plugins which may have domain-specific settings. What this means is that I basically have to do the same thing I would be doing with the WXR file, that being open it with a text editor, "fix" stuff and then send to a new MySQL db. But then there's the added problem of not knowing whether it would work correctly or not. At least with manually editing a WXR file it's more or less guaranteed to work, whereas the MySQL way wouldn't be.

Q: Why not just uninstall all your plugins and then do a MySQL db export?

A: Many plugins for WordPress create tables in the MySQL database. If you uninstall (as in "deactivate" and physically remove via FTP), the tables will still be there. This is a huge problem with the way plugin authors do plugins for WP. If I'm going to move the content over to a new blog, I want to reinstall all plugins from scratch so I don't have any needless tables in the db.

A classic example of this is Podpress, a popular WP plugin. If you install it, then uninstall it, check your MySQL database. You'll find now-useless podpress specific tables in there and there's not a frickin' thing you can do about it save for manually removing them via phpMyAdmin.

Granted, having extra tables in the WP database won't "hurt" its operation but it's better to start off with a fresh db and reinstall the plugins so they all point to the right domain.

. . .

And now The Big Question answered for existing WordPress authors:

How does one break up a big WordPress WXR file into smaller ones?

There is no automatic way to do this so you have to do it manually, but it's actually fairly easy.

First I strongly recommend getting a text editor that can handle really large text files. I use Notepad++. It's free. Windows Notepad cannot handle super-large text files (and never really could).

I will assume you're using Notepad++, which by the way has tab support (very slick).

Open up the big honkin' WXR file, then open up a new blank tab so you have both the WXR file and the blank file open at the same time side-by-side. You can switch back and forth between the two easily this way when you copy/paste stuff. And trust me, you'll need to.

You need to copy the top of the WXR file until the first instance of <item>. You copy everything above <item> into the new blank text file. Depending on how your WordPress is set up, the first instance of <item> will be somewhere between line 35 and 55. Notepad++ has line numbers on the left and they're easy to spot.

You need to copy two lines from the end of the WXR file. This is easy; copy the last two lines which are </channel> and </rss>. Paste these at the end of the new text file you created.

Create a few more blank files as tabs in Notepad++. Copy and paste everything from the newly created file (not the WXR) and paste into each new tab. If you have a really really big honkin' WXR, create at least 4 new files.

Every post and page in the WXR file starts with <item> and ends with </item> (note the slash).

Go to the top of the WXR file and find the first instance of <item>. Start from there, highlight about roughly 30,000 lines and stop at an instance of </item>. Cut this text, go to one of the new tabs you created and paste it before </channel> (the second to last line).

Go back to the WXR file, start with <item> again, highlight another 30,000 lines ending at an instance of </item>, cut that, paste it in your second newly created file. Repeat process for the third file, fourth, fifth if needed, etc. You get the idea.

Save the first newly created file as 1.xml, the second as 2.xml, the third as 3.xml and so on.

You'll then be able to import every file into a new WordPress installation as the sizes are much smaller and easier to manage.

. . .

To note, the only reason I'm having to do this is because I'm forced to due to the fact the import process screws up.


Best ZOOM R8 tutorial book
highly rated, get recording quick!


More articles to check out

  3. Unexpected surprise, Casio F201
  5. You should surround yourself in guitar luxury
  6. Forgotten Gibson: 1983 Map Guitar
  7. Casio MTP-V003, the one everyone missed
  8. Just for the look: Peavey Solo guitar amp
  10. The Ice Pirates 1984