b2evolution 0.9 to WordPress 2.7 Migration Script

April 1st, 2009

For the previous 5 years, nicj.net ran on a blogging platform called b2evolution, one of the hundreds of CMS (content-management systems) available.  b2evolution was pretty revolutionary for its time, and worked good as a platform in 2003.  Over the years, the version I had been running (0.9) became rather old and out-dated.  There were probably a few unpatched security holes in the version I was running, but I was getting frustrated at paying the “upgrade cost” to keep my website up-to-date with the latest releases.  Each new release took time to upgrade and invariably caused problems that I would have to spend time debugging.  Lately, there was a big problem with comment spam, which can be annoying to keep on top of.  b2evolution doesn’t have a good solution to reduce comment spam, whereas several newer blogging platforms use Akismet to help fight it.

So over the last year, I’ve been looking for a new blogging platform.  WordPress is the successor I chose.  WordPress is similar to b2volution (both spawned from the same parent), but what impresses me the most about WordPress is how clean the interface feels and how powerful the blogging platform is with all of the community plug-ins available.  Upgrades are seamless as well (as simple as a subversion ‘update’ command).

The problem was what to do with all of the old posts on nicj.net in the b2evolution MySQL database.  Not that anyone cares what I wrote during my junior year of college, but I was hoping to at least be able to archive some of those old posts as ‘private’ so I could have a journal that I could look back to at a later date.  I was sure someone had done b2evolution to WordPress posts/comment/users migration before, and sure-enough, there are several scripts out there:

The problem is, each script has its caveats: migrating from a specific b2evolution version to a specific WordPress version, and each has their own incompatabilities with my situation.

I finally settled on one from tumahler.com, and modified it a bit to suit my own migration needs.  Changes are:

  1. Supports b2evolution 0.9 to WordPress 2.7 migration
  2. Script can read from one b2evolution MySQL DB and write to a different WordPress MySQL DB
  3. Migrates posts marked as b2evolution private to WordPress private
  4. Sets categories for posts
  5. Only posts and comments are migrated (not users, metadata or categories)

So I’m adding my script to the mix of publically available b2evolution -> WordPress migration scripts, in case it will help anyone:

https://github.com/nicjansma/migrate-b2evolution-to-wordpress (b2evo 0.9 to WP 2.7 tested)

Please note: Only use this on a clean WordPress install, as it will delete any WP posts, comments and metadata before the migration of b2evo data.

Share this:

  1. Marco
    April 4th, 2009 at 07:55 | #1

    Comparing a b2evo version from 2003 with a wordpress version from 2009 on their antispam capabilities… Not very fair my friend.

    • April 4th, 2009 at 09:25 | #2

      That is true. It looks like the most recent versions of b2evo have an Akismet plugin. However, when I was researching what blogging engine to use, I tried the demo of the latest version of b2evolution (http://demo1.b2evolution.net/stable/admin.php?login=admin&pwd=demopass). I was much more impressed with the layout and feel of WP as compared with current b2 skins. It’s all a matter of taste. Previous versions and upgrade pains of b2evo had turned me off from using it for the future.

  2. PK
    April 24th, 2009 at 11:47 | #3

    Was this supposed to be a funny joke that deletes all of my WordPress posts? Or is that an unpleasant side-effect of my having used it on b2evolution 1.x? Now that I look, your blog post was published on April Fools Day. Crap.

  3. April 24th, 2009 at 12:23 | #4

    I’ve updated the post to put a disclaimer that it should only be run on a “clean” (i.e. no posts or comments) WordPress install, as it needs a fresh database. Apologies. In the future, I would highly suggest browsing any code you’re going to run from the internet — the first few lines show several DELETE FROMs that clear all old posts, comments and metadata.

  4. PK
    April 24th, 2009 at 13:26 | #5

    I actually did browse it, and I saw the delete stuff, but I honestly didn’t care. In the end, your code saved me lots of trouble. My last comment was sorta tongue-in-cheek (I’m actually a pro web guy, but not a hardcore programmer). The first thing I did was back up my database before continuing. I was just so desperate to find someone else’s code to reuse because I wanted this done fast and easy.

    To fix it, I had to redo all my b2evo installs, since I had to restore several databases. I went backwards from 1.x to 0.9.x, then ran your script, then exported all the posts from WordPress, then did it again with the other b2evo posts from all my backup databases, exporting the results from WordPress each time. After that, I restored my original WordPress database from backup, then imported the b2evo posts that I’d exported.

    Now I can update to the newest WordPress! Thanks for this script, Nic – it saved my day. Cheers!

  5. April 24th, 2009 at 21:54 | #6


    Really glad to hear it worked for you! That’s exactly why I took the time to post the script in the first place — I was hoping someone else would find it useful.

  6. PK
    April 25th, 2009 at 10:45 | #7

    Thanks, Nic.

    Although it’s quite clear that this script is meant for B2evo 0.9.x, it’s probably worth mentioning to anyone who comes across this page that you shouldn’t even bother trying with a later version of b2evo – it will not import your posts. The reason I was able to downgrade from 1.x back to 0.9.x so easily is because I wasn’t actually using b2evo to begin with – I was using the old version of b2/cafepress – 0.6.2 I think – so I was able to upgrade from that to the b2evo version of my choice. So, note that I did not actually downgrade – I just re-upgraded from my old b2/cafepress backups. Any attempt to downgrade your b2evo install is at your own risk (and probably won’t work very well).

    Download archived b2evos here: http://b2evolution.net/downloads/index.php

    Sorry for the long-winded posts 🙂

Comments are closed.