Pin Me

Tips for Migrating a Site from Drupal to WordPress

written by: Matthew Craig•edited by: Michele McDonough•updated: 11/30/2010

Migrating a site from Drupal to WordPress does not have to be rocket science. Follow the 8 simple steps below, and you'll be on your way to publishing with ease. With step-by-step instructions and clear screen shots, this guide will have you up and running in no time.

  • slide 1 of 1

    Drupal to WordPress Migration

    Before jumping into the nuts and bolts of migrating Drupal over to WordPress, let’s establish a few basic ground rules:

    • If you’re in the middle of settling a domestic dispute, please resolve the crisis. You will not need a good chunk of time to complete this task, however, your undivided attention is requested. Estimated time: 60 minutes.
    • More important than a calm atmosphere: Do not attempt on a live server. Always make sure you have a backup of your current database (DB).
    • Be sure you have two databases set up. One named WordPress and another titled, you guessed it, Drupal.

    On to the good stuff...

    ~ The following is a list of SQL sequences you’ll need to conduct in order to complete a Drupal to WordPress migration.

    Step 1 - Remove all WordPress content

    Now you know why it’s imperative to backup your DB. If you’re having doubts about this whole migration thing, well, refer back to your original installation and no one is left holding the bag.

    The example below assumes you have an average working knowledge of SQL and database management. Even for novice users, these are simple SQL queries. (Click any image for a larger view.)

    clear wordpress Ba da bing! Your DB should be cleaner than the Smithsonian.

    Step 2 - Category creation and setup

    It doesn’t matter how many categories you plan to create. Use the following script and you’ll be fine.

    create categories 

    Sometimes the categories won’t appear automatically. Chances are you have cached variables in the server or DB.

    DELETE FROM wp_options WHERE option_name = ‘category_children’;

    • Restart your server or use the following PHP command to flush variables:


    Step 3 - Don’t forget about Taxonomies

    This is a fairly simple task. Never heard of such a word? Well, just think of grouping and assigning different characteristics to various posts. Even though Wordpress has some built in taxonomies, you’ll need to run the following sequence in building a custom installation.

    taxomonies Step 4 - Migrate posts & pages

    This query should import everything cleanly. However, this does not turn articles into posts...see Step 5.

    posts pages Step 5 - Post creation & category alignment

    Look at the following script(s) carefully. It’s important you notice which posts are being aligned and how they are being designated. Articles in the previous step will be converted to posts and the post / category alignment will be established:

    Post creation -

    articles posts 

    Category alignment -

    create categories Step 6 - Create category count

    Probably the easiest of all steps. Use the following query and you won’t have to change around any of the syntax details.

    category count Step 7 - Comments, comments, comments

    This process is similar to importing and updating categories. Don’t forget to update the counts...after importing of course.

    Import -

    import comments 

    Update counts -

    comment counts 

    Step 8 - Finalize post content

    Fix all images and post breaks. Thankfully, there’s an easy way to do this. Use the following sequences to fix 1.) breaks, and, 2.) images.

    Breaks -

    fix content 

    Images -

    fix images Go back and check for any errors in the posts, categories or pages - anything you might need to check before moving on. This should go without saying.

    Always do a double take before deleting any existing tables.

    If all eight steps have been executed, you should be able to delete the old Drupal database and work solely from your new WordPress installation.