PapaScott I like big blogs and I cannot lie! 🐘

Export from WordPress

Update 5 May 2005: A lot of people seem to be using this script. Since I'm not using WordPress right now, I haven't really been maintaining it. A better alternative might be the WPexport plugin by Eric Pierce, since, unlike me, he regularly exports WordPress blogs (for students at the University of South Florida).

To paraphrase Sam Ruby, a weblog software is only as good as its export function. So inspired by Shelley, starting from a b2 export script by Bill Grady, and to celebrate the release of Movable Type 3.1, I've just made WordPress a hell of a lot better. I humbly present Version 0.1 of an export script for WordPress for the Movable Type import format.

A few caveats, apart from the usual it-works-for-me, your-mileage-may-vary and backup-your-data-first.

1. It does not deal (yet) with entries with multiple categories. I don't use multiple categories, so I don't need this, but it could be done by adding yet another JOIN statement to the SQL and some fiddling with the output logic.
2. There are a few settings that I've chosen not to read from WordPress, but instead to set explicitly in the script. If you look in the print_post function, you'll see
echo ("STATUS: Publish/n");
echo ("ALLOW COMMENTS: 2/n");
echo ("CONVERT BREAKS: markdown/n");
echo ("ALLOW PINGS: 0/n");

I.e., all posts are published, all comments are closed, all pings are allowed, and all posts are filtered with markdown. You may want to change these or comment them out to suit your needs.

3. The post slug from WordPress is copied into the key words field. To keep your existing URLs, you'll want to use a solution like Mark Pilgrim's cruft-free URLs. Note also that Movable Type uses underscores in their URLs; to have MT produce dashes automatically you'll need a plugin of some sort. Stay tuned.

3. When importing, make sure your character set matches whatever you were using with WordPress. Both WordPress and Movable Type now use UTF-8 by default, but if you're using something else, you'll want to adjust MT accordingly.

3. I'm also not yet dealing with extended entries, although that would also be easy enough to do. Everything gets thrown into the main post for now.

4. If you search the WordPress forums, you'll notice that inquiries about exporting to Movable Type are met with abuse and derision. Be prepared for the same if you actually use this script to export your blog to Movable Type.

I'll be happy to update the script if anyone cares to correct any of these caveats (or anything else that I haven't thought of). For your abuse and derision, you can see the result of the export at (temporary URL, don't go linking to it or anything).

comments powered by Disqus