If you’re considering a Drupal to WordPress migration, these resources will help you export your content. Although I feature my own tools here, much of the information presented will be useful regardless of the method you choose.
Many developers and site owners jumped on the Drupal bandwagon in the early 2000s. At that time it was the only real option for a content management system (CMS). While Drupal still has advantages for content rich applications, those with simpler needs are now looking to migrate their sites. WordPress is an ideal alternative because of its smaller footprint, friendly interface, lower maintenance overhead and rich plugin ecosystem.
Table of contents
1. Before you start
Drupal to WordPress migration projects are often complex and need to be handled carefully. Rather than jumping in head-first, take some time to plan your approach. Before continuing, I highly recommend reading my guide, How to prepare for your Drupal to WordPress migration project. Furthermore, you may want to check the resources section for additional worksheets and guides. Also keep in mind that not all aspects of a migration are practical to automate. In many cases, you may need to make manual adjustments post-migration using the WordPress interface.
At any rate, you should at least take some basic planning steps before you begin:
- Consider why you are migrating to WordPress.
- Decide on your approach to building the WordPress theme.
- Be aware of any SEO impact when migrating to WordPress.
- Gather as much information as you can about your Drupal installation.
- Write a Drupal to WordPress migration mapping document.
Incidentally, it’s easy to overlook the fact that you don’t need to make an exact copy of your Drupal site in WordPress. Prioritise the highest value content and functionality if time and budget is tight. To that end, putting together migration requirements will help focus your efforts.
These scripts and tools run MySQL queries to read information from a Drupal database and convert the content to WordPress. They may write temporary tables and make changes to your Drupal content. With this in mind, it’s imporant to avoid working on your live Drupal database. Above all, make backups before using these tools.
2. Migration options
I’ve been migrating sites since around 2011 and conclude that there’s no single method suitable for everyone. Generally speaking, you can:
- Migrate manually: If you have a small site and some time on your hands, you can simply copy-and-paste all your content across. It’s an incredibly boring task but sometimes a low-tech solution is what’s needed.
- Install a plugin or automated migration software: Several companies offer software that try to migrate content. CMS2CMS and FG Drupal to WordPress appear to be the main choices at the time of writing. CMS2CMS charges a fee calculated from the amount of content you want to migrate. FG Drupal to WordPress, on the other hand, follows a ‘freemium’ model. Since I’ve personally not needed to use this kind of software, I’m unable to comment on how well they perform.
- Customise an open-source migration script: The tools I offer fall into this category. Furthermore, there are plenty of scripts and tutorials detailing how you can go about exporting Drupal content into WordPress. Still, you should carefully consider if the time investment and effort needed is worth any monetary savings.
- Hire a migration consultant: Since I offer a Drupal to WordPress migration service, it goes without saying that I’d recommend this route as the one giving the best results. Admittedly, budget is an important factor so hiring an expert will consequently be unrealistic for some. Nonetheless, those with heavily customised content types, complex taxonomies or specialised modules may have no other choice.
A quick plug
I give away lots of information for free so here’s a quick plug to keep the lights running. Site migrations are often very time consuming. You can therefore save yourself considerable effort by hiring me to do the job.
Of course, if you’d rather try exporting content yourself, feel free to try my utilities below.
3. Web-based Drupal to WordPress export utility
This web-based utility, released in 2013, was my first attempt at building a Drupal to WordPress migration tool. It was based on my in-house scripts to migrate standard content types from Drupal 6 to WordPress 3.5. Although functionality is rudimentary and the tool is no longer being maintained, it might be useful for simple sites if you have a technical disposition. The code uses PHP 4 so you’ll need to make changes to run on modern environments.
- Migrates content from Drupal 6 to WordPress 3 and 4 database
- Shows number of Drupal terms, node types and entries to be migrated
- Select Drupal content types to be converted into WordPress posts
- WordPress file directory setting
- WordPress permalink structure setting
- Select which Drupal terms will be used as WordPress categories
- Select the WordPress default category
Web-based content migration: Installation and use
- Copy the package folder to a web server.
- Edit the MySQL queries. (See below.)
- Run the drupaltowordpress.php script on your browser and follow the on-screen instructions to export content.
Both the Drupal and WordPress databases should be on the same server and share the same connection details.
Editing the MySQL queries
While the web front end works with very basic Drupal installations, anything more complicated will need custom SQL queries. These can found in the
drupaltowordpress-custom.sql file. The script contains sample values so don’t run it without understanding what will be performed at each step. You’ll need to edit the SQL queries to suit your own Drupal setup. For more information, see the SQL queries section below.
For post-export troubleshooting, please see Drupal to WordPress migration notes for additional help.
4. Command-line Drupal to WordPress migration tool
I wrote a Python-based command-line tool because the web-based export utility proved too inefficient for complex Drupal configurations. Although it requires more manual editing of MySQL queries, you can more conveniently run heavily customised site migrations.
Command-line content migration: Installation and use
- You will need to install the Python modules in the requirements section below.
settings.pyand edit it to match your migration project settings.
- Edit the included SQL sample files in the
sql-sampledirectory to suit your migration requirements. At a minimum, you will need the migration script itself (see the sample
- Run the utility using the help flag to view the available commands:
$ python d2w.py -h
Customising the export script for your Drupal setup
The Python script itself won’t perform the migration. To emphasise, you must supply it with an export SQL file containing the migration queries. See the SQL queries section for more information.
Required Python modules
- MySQLdb for accessing the backend Drupal and WordPress databases
- prettytable for displaying results in a table format
- phpserialize for unserializing Drupal fields
Note: all my latest versions of the command-line tool now include a
requirements.txt file which you can use with a
pip install -r command.
5. Migration SQL queries
Both the web-based and command-line utilities are simply convenient wrappers for SQL queries. While you can run a migration by typing out individual queries in a database client, this will prove to be very tedious for all but the simplest of configurations. In fact, I built these tools precisely because manually entering SQL queries, line-by-line, quickly became unworkable.
It’s important to realize that these queries are the engine of the migration. Consequently, understanding your Drupal database and composing the right SQL queries are key to a successful migration. Because the interface wrappers are useless without the queries, I’ve included a sample set in both packages. For information about customising the export script to suit your Drupal setup, see my step-by-step explanation of the Drupal to WordPress migration SQL queries.
In general, you will need queries to migrate following:
- Vocabularies and taxonomies
- Drupal nodes to WordPress posts
- Comments and comment authors
You may additionally need to include queries to clear out unwanted content, merge terms, or export custom fields.
6. Database tools and migration helper utilities
Content migrations involve spending a great deal of time manipulating the database. It’s therefore useful to have a set of tools to make things easier. Here are some third-party utilities that can help with your migration project:
- WP-CLI: A command-line interface for WordPress that I’ve found particularly useful during migration projects. For instance, you can use it for installing a new instance of WordPress, updating user credentials and activating plugins. WP-CLI will save you having to write SQL queries for simple database tasks that go along with a migration project.
- Database search and replace script: Sometimes you need a way to search and replace text in the database. This PHP-based tool is useful for environments without command-line access, such as those offered by cloud-based hosting providers.
- Search & Replace WordPress plugin: Though I haven’t personally used this plugin, quite a few developers seem to recommend it.
- Drupal to WordPress Image Migration plugin: Brendan Carr’s WordPress plugin to help migrate images from Drupal 6.
- Drush: A Drupal command-line shell which can be used, for example, in migrating Drupal sites. In particular, you can use it create a development version for analysis prior to exporting to WordPress. As a matter of fact, there’s a
drush bam-backupcommand to backup a site’s database with the Backup and Migrate module.
7. Post-migration troubleshooting
You may encounter problems with your WordPress installation due to the complexity of many migration projects. For example, WordPress might display permissions errors when trying to log in. Furthermore, content that seems to have been migrated may show a ‘Not found’ error. There could be any number of reasons for these problems. Checking my Drupal to WordPress migration notes might point you in the right direction.
8. Other tools, resources and guides
Drupal to WordPress migration worksheet
It’s important to gather as much information possible about your Drupal installation before starting the migration project. You can use my Drupal to WordPress migration worksheet to help structure your investigation process.
How to write a migration mapping document
Preparing a migration mapping document before starting your project will save you time. It simplifies the project by giving everyone a clear idea about the type of content involved. This short overview will get you started with writing a migration mapping.
Preserving SEO during a Drupal to WordPress migration
Is SEO is important to the project? See my guide for preserving SEO during a Drupal to WordPress migration. I explain the differences between Drupal and WordPress URL structures and pitfalls to keep in mind. Read it on the blog section: Preserving SEO during a Drupal to WordPress migration.
If you’re running your own Drupal to WordPress migration project and encounter problems, you might find some solutions in my migration troubleshooting articles.
Scott Anderson’s blog post
Much credit goes to Scott Anderson and his blog post, How I migrated a client’s blog from Drupal to WordPress 3.0. His set of MySQL queries were invaluable when I started migrating client sites from Drupal back in 2011. Scott cites Mike Smullin, D’Arcy Norman and Dave Dash as sources.
A Guide for Drupal Developers Migrating to WordPress
This guide from OnTheGoSystems gives Drupal developers an introduction to the WordPress interface. While it doesn’t go through running a content export, it’ll help if you want a quick introduction to using WordPress.
The WordPress Codex has a page on importing content form different sources, including Drupal.
Other migration tools
Looking to migrate other types of content? Visit my migration tools page for utilities to migrate content from other platforms.
February 2017: This page has been receiving lots of traffic over the years. I’ve therefore converted it to a general Drupal to WordPress migration resource in the hope that it provides more value to visitors.
August 2015: It’s been some time since I’ve updated the web-based PHP Drupal to WordPress Migration Tool. After a number of Drupal to WordPress migrations, I find the PHP and HTML platform to be inefficient for complex Drupal configurations. pyD2W is my Python-based command line replacement better suited to complex set-ups. View the repository on GitHub.
July 2015: Do you need to migrate images from Drupal to WordPress? Check out Brendan Carr’s Drupal to WordPress Image Migration plugin.
21 June 2014: Moved the The Drupal to WordPress Migration Tool repository to GitHub.
26 May 2013: First release of the The Drupal to WordPress Migration Tool: drupaltowordpress-d6w35-0.3.zip
|pyD2W, a command line Drupal to WordPress Migration Tool||Python||GitHub|
|Web-based Drupal to WordPress Migration Tool||PHP & web front-end||GitHub|
|Sample SQL queries for migrating content||MySQL||GitHub|
CAUTION: Make a backup of both your Drupal and WordPress databases before running these scripts. USE IS ENTIRELY AT YOUR OWN RISK. I’m offering them with no warranty or support implied.
Scott Anderson of Room 34 Creative Services. The queries for migrating from Drupal to WordPress are based on a post at the Room 34 blog: How I migrated a client’s blog from Drupal to WordPress 3.0
David Coveney of Interconnect IT Ltd (UK). I used UI elements of Interconnect IT’s WordPress Search and Replace Tool as a starting point to create the in-house scripts on which this tool is based. WordPress (and others) Search and Replace Tool
- Construction graphic courtesy of and copyright Free Range Stock, artist: Jack Moreh