Rob Cottingham

9 Oct 2005

WordPress to Drupal: a luta continua

Category: Blogging; Technology

I’m considering migrating this site from the superb open-source blogging platform WordPress to the superb open-source content-management system Drupal.

It turns out that isn’t nearly as simple as it sounds.

You would think it would be easy. To move the content, all you’re really doing is mapping the bits of WordPress’s database onto the corresponding bits of Drupal’s database.

There are a number of folks out there who say they have the answer. One of them comes close: Sam Revitch at Least Significant Bits has kindly released a script called WordPress Migration Utility. Update: See the comments below… it does more than come close. It worked.
The documentation is an issue, partly because the readme file is for a previous incarnation. It tells you to invoke a file called wp_goto_dr.php, which isn’t actually included in the installation. And it took a little poking around with settings to get it to actually run, but run it finally did, importing post after post with very few problems (an oddly-formatted headline here and there) — until it worked its way forward to March 24, 2004..

The script reported an error, “Duplicate entry ‘20040324′ for key 2″. I had a look, and couldn’t find any problems in the database. But every post from that point forward is stored as a comment to earlier posts. Not helpful.

Also not helpful: if you’ve used WordPress’s features to flag comment spam as such, those comments rise from the dead and show up hale and hearty in your posts, happily flogging poker and pharmaceuticals.

So the search continues. I’ll keep you posted — and I’ll also let you know if I can get Sam’s script working.

Subscribe to comments on this post

4 Responses to “WordPress to Drupal: a luta continua”


  1. Evan Leeson says:

    One thing that will bug you is implementing a blogroll. Let me know if you find a good solution (other than ASP). I’m sure something is coming from the Druniverse, but it hasn’t arrived yet.


  2. Rob says:

    Alex reports seeing a code snippet along those lines; I’ll see if she can remember where.

    I use Bloglines for the blogroll here, but

    a) it requires every link to have an RSS feed, and

    b) if Bloglines is slow, so is this page. Which bites.


  3. Gerd Riesselmann says:

    The error you get is because of the way you defined your clean urls, I guess. Note that the table url_alias defines the field dst (destination) as beeing unique.

    May it be you have two entries on March 24, 2004, so the script tries to create two alias with the same destination?

    Try to remove the index on this field during import and bring the script up again. Fix any issues by hand and enable the index afterwards.

    I’m looking forward to hear more of your experiences with moving from WordPress to Drupal, since I’m in the same process right now.


  4. Rob says:

    At long last, I had the chance to try out Gerd’s advice. And what do you know — the blog imported flawlessly. Categories were imported into the taxonomy, comments were imported into comments… very nicely done.

    One suggestion: WordPress allows HTML tags in titles, while Drupal frowns on it. If the script could be amended to strip them out, that would be a handy enhancement.

Leave a Reply

A few hints: HTML works fine, but if you want a web address to appear properly (especially a long complex one), please use <a> tags -- WordPress does ugly and unfortunate things to things like ampersands.

Privacy policy: I respect your privacy. I will not forward your personal information to any other parties except as required by law, and will use your e-mail address only to respond to feedback. When your comment appears, your name will appear on this page, linked to your web address.

Creative Commons License This work is licensed under a Creative Commons Licence. Please attribute to Rob Cottingham with a link to the content's original page on this web site.