Converting Drupal 6 to WordPress

I’ve just moved my blog from Drupal 6 to WordPress. There’s several reasons for this:

  • I was only using Drupal in the first place to get some experience using it. It’s a great CMS but is overkill for just running a blog.
  • WordPress comes with Akismet for reducing comment spam out-of-the-box.
  • I just got a Nexus 7, and there’s a nice WordPress app for Android.

I wasn’t, however, keen on losing my old posts and comments. No problem, Drupal and WordPress are both open source and widely used, there’ll be tools to convert between them, right? Actually, not so much.

The best thing I found was this post on Migrating Drupal to WordPress and the associated Java script (that’s a script, written in Java, not a JavaScript file).  I had to tweak the code a bit to get it working, I’ve put the resulting code on Github.

I’m not really a Java guy, so getting it to run was new for me. Here’s the steps I took (on Ubuntu 12.04):

  1. Dumped the databases for my existing Drupal and a clean WordPress install from my web server to SQL files on my local machine.
  2. Imported both files into a new database on my local machine.
  3. Downloaded the .java file
  4. Edited the database credentials in the .java file to match those on my local machine (wpPrefix variable, drPrefix variable and return line of getConnection method)
  5. Installed the dependencies required to compile and run the file
    ~/$: sudo apt-get install openjdk-6-jdk libmysql-java
  6. Compiled and ran the file
    ~/$: javac -cp . DrupalToWordpress.java
    ~/$: java -cp .:/usr/share/java/mysql.jar DrupalToWordpress
  7. Exported the resulting WordPress tables from the local database, and imported them back into the database on my web server

A bit of a palava I think you’ll agree, but as you can see, it worked!

Bookmark the permalink.

One Response to Converting Drupal 6 to WordPress

  1. Howardwlc says:

    Nice pieces of advice!
    Also, there’s way to save your comments and posts during the drupal to wordpress migration – move it with the help of automated migration tool. There’re a few of them, e.g. cms2cms moves such entities, plus this service is good for those who are not technically savvy or who wants to save much time. As far as i know service is reliable according to the responses.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>