Drupal to WordPress migration scripts to export the content from Drupal to WordPress. They run a series of MySQL queries to read information from a Drupal database and convert the content to WordPress. Temporary tables are written to the database and some changes may be made to your Drupal content. Backup your Drupal database before using this tool. You may need to make adjustments to your settings after running the migration to get your WordPress installation ready for launch.
Web-based Drupal to WordPress export utility
This export utility migrates standard content types from Drupal to WordPress. (See this article for some background information.) The functionality is rudimentary and hasn’t been updated in a while. It was built on PHP 4 so you may need to make changes to run on your environment. I recommend using my Python command-line tool for more heavily customised Drupal installations.
The web-based Drupal to WordPress migration tool offers the following functionality:
- Migrates content from Drupal 6 to WordPress 3 and 4 database
- Shows number of Drupal terms, node types and entries to be migrated
- Option to select which Drupal content types to be converted into WordPress posts
- Option to set WordPress file directory
- Option to set WordPress permalink structure
- Option to select which Drupal terms will be used as WordPress categories
- Option to select the WordPress default category
Web-based content migration: Installation and use
Copy folder to a web server or hosting account and run the drupaltowordpress.php script on your browser. Follow the on-screen instructions. You should be able to use any type of MySQL and PHP environment so long as the code can connect to both the Drupal and WordPress databases on the same server. Both databases must share the same connection details.
The web front end works with very basic Drupal installations but for anything more complicated, you will get better results by customising the SQL queries in the file drupaltowordpress-custom.sql. Do not run the custom script without understanding what will be performed at each step as it contains sample values. You’ll need to edit the queries to suit your own Drupal setup. For more information, see Drupal to WordPress migration explained.
For post-export troubleshooting, please see Drupal to WordPress migration notes for additional help.
Command-line Drupal to WordPress migration tool
The web-based export utility proved too inefficient for more complex Drupal configurations so I wrote a Python-based command line replacement. It requires more manual editing of MySQL queries but allows for heavily customised site migrations.
Command line content migration: Installation and use
- You will need to install the Python modules in the requirements section below.
- Rename the settings-template.py to settings.py and edit it to match your migration project settings.
- Edit the included SQL sample files in the sql-sample directory to suit your migration requirements. At a minimum, you will need the migration script itself (see the sample migration_standard.sql file).
- 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. You must supply it with an export SQL file that contains the migration queries. 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.
Useful supporting script files are a dump of a pre-configured (but empty) WordPress installation and a dump of your Drupal database in a clean state before any migration attempts. Since migrations can often take several passes of fine-tuning, it can help to reset your databases.
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
You may encounter some problems on your WordPress site after running a migration. For example, WordPress might display permissions errors or content that seems to have been migrated shows ‘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.
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 more complex Drupal configurations. pyD2W is my Python-based command line replacement that is better suited to complex set-ups. View the repository on GitHub. I’ll no longer be updating the web-based version to focus on the Python replacement.
July 2015: If 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 on GitHub||Python|
|Web-based Drupal to WordPress Migration Tool on GitHub||PHP & web front-end|
CAUTION: Make a backup of both your Drupal and WordPress databases before running this tool. USE IS ENTIRELY AT YOUR OWN RISK. I’m offering this tool with no warranty or support implied.
Supporting future development
The Drupal to WordPress Migration Tool is available completely free of charge. If you find it useful, please consider making a donation to support future development. I would like to add many more improvements but this would only be practical if I can justify taking time away from other revenue generating work. Thank you!
Other tools, resources and guides
Drupal to WordPress migration worksheet
It’s important that you gather as much information as you can about your Drupal installation before running your migration project. You can use the questions in my Drupal to WordPress migration worksheet to help structure your investigation process. I can help you with this if you’re not able to run the investigation yourself. Please ask for details.
How to write a migration mapping document
Preparing a migration mapping document before starting your project will help save you time. It will also reduce the complexity of the work by giving everyone involved a clear idea about the type of content will be involved. This short overview will help get you started with writing the migration mapping document.
Preserving SEO during a Drupal to WordPress migration
My guide for how to preserve 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.
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 (site offline), D’Arcy Norman and Dave Dash (site offline) as sources.
A Guide for Drupal Developers Migrating to WordPress
This guide from OnTheGoSystems gives Drupal developers an introduction to equivalent WordPress controls and features. It doesn’t go through running a content export but it’ll help if you want a quick introduction to using WordPress.
Drupal to WordPress Migration Plugins
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.
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