While of course we never like to see anyone give up on Habari, it’s obviously not going to be the perfect platform for everyone. Hopefully most people will test it out before they make a final switch, but for those who get stuck and wish to switch back to WordPress (and we know you’re out there), I’ve finally throw together a quick script that should help.

Things this migrates:

  • Posts - published or draft
  • Pages - published or draft
  • Comments - approved only
  • Tags

A few caveats: this is MySQL-only, if you’re using Habari on Postgres or SQLite I’m sorry. It wouldn’t be especially difficult to change, I just have no interest in doing so - it suites my purposes. It’s also quite hacky. There’s very little error checking (make that practically none) and it prints output in plain text. It’s also not a plugin, I wrote it as a one-off script that you use and immediately trash because that’s exactly what you should do with it.

Also note that it writes directly to the WordPress database tables, it uses none of their API functions. That means the slightest schema change could (and probably will) break the whole thing and that things like filtering and other plugin actions aren’t performed. I was using the trunk build of 2.9-rare, so roll back to about r11867 if you have problems.

Finally, it will set the owner of a post to an existing WordPress user with the same username if one exists - if not it will create a new user account that you can then manage any way you like.

So how do you actually use it? Well, you dump it in your Habari root directory, edit the array at the top so it can connect to the MySQL database your WordPress instance is installed in, and you load it up in your browser. You should see a bunch of junk about things it finds - and hopefully no MySQL errors along the way. If you see any errors, you’re on your own.

On my VPS I was able to import my blog back into WordPress in a matter of about 2 seconds. For those who want or need to switch back, best of luck to you, hope this helps.

Snag the script over here: wp_migrate_script.php

Originally published and updated .