Migrate a WordPress site to Drupal

Recently I've been helping a few folks convert websites from to . Presently this works for migrating to Drupal 5 so if you want a Drupal 6 site first migrate to Drupal 5 and then upgrade the site to Drupal 6.

There are a couple of different ways of approaching this task. In the distant past I've worked with . Those experiences are a distant enough memory that I can't speak to it one way or another. It does seem that it has been a while since that module was upgraded. On the other hand is undergoing active development. One user I worked with in IRC was struggling with wp2drupal and found Wordpress Import to be very simple. Also a note that the Wordpress Import module has been updated since I've used it so some of the steps may not be necessary.

The process really couldn't be simpler. Start with an WordPress export of an extendedRSS file. With this in hand you'll need a Drupal site setup. The site can either be new or an existing site but these hints apply to using a new site. The import process is very simple you select the extendedRSS file and tell Drupal which WordPress users map to which Drupal users. With that done the data now resides in the Drupal database. Things are pretty good but there are a few tweaks that make things better. The creation time for the items has been set to the creation time from WordPress. However, the updated time is set to the time of the import. This really matters most if you have search enabled on your site. Search results show the time changed in the display.

Setting the updated time to the created time is a simple SQL query. Note that these examples are for MySQL.

UPDATE node n set n.changed=n.created;

This sets the changed time to the created time.

In one case the Blog module wasn't enabled during the import so all of the WordPress blog stories came in as stories. This too is easy to change:

UPDATE node set type="blog" WHERE type="story";

One other little change cleans things up considerably. When Wordpress Import does its magic it imports tags that contain hyphens instead of spaces. This too can be easily remedied with a SQL query. Note, however, that doing this will also remove hyphens from any tags that are supposed to have hyphens.

UPDATE term_data set name = replace(term_data, "-", " ");

Note that if this is an existing database with some small amount of work it is possible to add WHERE clauses to these statements in order to limit the effects to the newly imported WordPress data.

For a before and after, as well as a look at some nice variations on a Drupal theme you can look at (WordPress) and its migration to (Drupal 6)..



Exporting from Wordpress

Generating the Wordpress eXtended RSS (WXR) file that the Wordpress Import module requires is extremely easy. In the WP admin interface, go to the "Manage" tab, then click on "Export." Click the "Download Export File" button and select a download directory. That's it!

How about redirects to maintain SEO

If an old blog was successful and has achieved good SEO results, it would be very important to maintain this. Does the WP Import module bring the old aliases into the drupal database? If path_redirect (as well as path and hopefully pathauto) module is installed it would be great if the import would populate the db table so that the search engines and bookmarks could find the new home for these articles. As long as you could modify the htaccess file on the old site, you could have the incoming links redirected to the new site with the path intact so that drupal could figure out the redirecting on it's end.

BTW, great post. Thanks.

Aliased paths

It brings in the WordPress path '?p=123'. The site I helped move had this as the URL style so I don't know offhand how the WP eXtended export handles this that would be the determining factor. If wordpress export gives up the aliased paths then it would be pretty simple to map them. In this case, too, both the new and old servers live on, at least for now, so it would most likely come down to writing a site specific mapping table for Apache rewrite. Hopefully I'll have a little time to explore this more soon.

Better idea

I think that migrating from one cms to another doesn't worth it.
better write your own. it might take some time but you will be satisfied.

Thanks for the help!

I searched for "wordpress to drupal" and this was the best tutorial I could find. It did the trick, and only took a couple minutes. Thanks!

drupal 6?

Any chance of there being a drupal 6 version being made?

I already have a drupal 6 site I'm working on and it would be a real pain to move back at this point.

New version?

Hi I'm looking at migrating from wordpress to drupal 6, is there a version in the works that supports 6 or should I just try and modify the code for drupal 6 myself?

No Drupal 6 yet... but...

There doesn't seem to be an issue in the queue yet for a Drupal 6 version. I'm sure if you worked on it the author of the module would be happy to see a patch in the queue. If there are elements of patching etc. that are challenging please don't hesitate to contact me and I'll be glad to help get the patch out there.

drupal 6


I've made it working for drupal 6 and wordpress 2.3. I'm currently working on it, to support more versions of wordpress.


Thanks for your work in getting that module to Drupal 6. Hopefully it will be contributed to Drupal.org.

For those new to WordPress to Drupal migration it is important to note that the wp2drupal module is different than the Wordpress Import module. I haven't recently used wp2drupal but can attest to how well WordPress Import works -- and it works very well.

Pictures / Images?

It does not seem to bring over the images from the original posts or the references to them in the code - if it at least kept the core HTML of the post, I could recreate the file structure for the legacy wordpress posts.

Any thoughts?

May have answered my own question...

By searching the exported file from the wordpress version - I think it did not export the orig post HTML - this would prevent the images from being referenced correctly. Do you know of a migration path that would use the old Wordpress database backup?

Scanner module

There is a module available, the Search and Replace Scanner that can do regular expression search and replace against your body fields. In the migrations I did, as well as in some Drupal to Drupal moves this has come in handy for doing search and replace on URL's in posts.

It's a full 8-hour-day job

It's a full 8-hour-day job, in my experience. I've done a number of these conversions now and I've developed a set of scripts we use in-house, for both WP 1 and 2. However, no matter how many migrations I do, if I want to retain things like taxonomical hierarchies, url paths ("permalinks"), photogalleries and the like (which the client usually wants to keep), the scripts must be modifed extensively every time. In fact the majority of the work is in tweaking the scripts themselves; once the scripts are ready the actual migration takes only a couple minutes. But with the variety of WP plugins and versions out there, there is no way I'd rely on a module to do this. It requires intimate knowledge of both db schemas, and custom tweaks for every job.

Wait, How do I Import??

You said

The import process is very simple you select the extendedRSS file and tell Drupal which WordPress users map to which Drupal users.

How do I "tell" Drupal to import this .XML file? I mean, where in the Administration Panel should I see an option to import something? (I am using Drupal 5.7).

Also, when you say "extendedRSS" do you really mean file wordpress.2008-06-18.xml which Wordpress spits out in the export, or is extendedRSS something different and special?

I was using Wordpress 2.5

Thanks a lot!

copy current site (created in word press) to new url

Is there a install script to "copy" an entire site created in wordpress with a backend- to a new url?

I have no html,ftp,root directory knowledge at all- but we have a membership site www. nobsinvestor. net where customers learn how to do Real Estate investing- they get a copy of our seller site and a copy of buyer site- inc. with membership. we purchase and host domain names... but had no idea it would be soooo expensive to have this done! Previously someone was doing it for 15.00 each! we found them right away and thought it must just be copy/paste- evidentially its not! we are getting 1-3 members a day- so thats 2-6 sites that need to be copied every day!

Can anyone help me?

WP to Drupal

I've had a look at Drupal and it looks pretty good. I currently run my discount codes site on WP. What advantages would Drupal give me?

Sorry if that sounds like I'm being picky, I'm not. I'd just like a heads up on the advantages.

Fix Trackbacks

Great article - I referred back to it several time as I migrated from wordpress to drupal. To answer a few people above: yes, images, urls, and everything gets transferred over. Google should still be able to find all the same content just fine.

One question, though. Wordpress import brings in trackbacks as comments - which is pretty annoying. Do you have a sql query that will fix those trackbacks? Trackbacks always starts with [...], but I'm not good enough with SQL to know how to sort all those out and make them trackbacks or something else.

I'm doing the opposite

I'm planning to move a Drupal 5 site to WordPress. I'm pretty disgusted with the Drupal 6 not supporting many of the modules I use, so upgrading to 6 would be pretty painful.

Switching to WordPress would lose some features, but it wouldn't be much more painful than upgrading to drupal 6 and I'll end up with a better future upgrade path. I don't want to have to go through a major trauma with every Drupal release breaking most modules. I've never had a WordPress upgrade break anything.

If the Drupal developers would put more emphasis on backward compatibility and making updates less painful, I would stay with it.

Importing users

While it's now perfectly possible to import all posts, comments and authors from a wordpress site to Drupal 6 using wordpress_import, it's not easily possible to import all users, which are not authors but have written comments for example.

You don't seem to get CMS's

You don't write your own CMS. That's a waste of time. You take an extensible one and extend it to suit your site. And if you have a lot of content in one CMS, it's good to know there are migration paths to others in case the one you are using now goes under.


Thanks for this post, which really save me. I was looking for a solution to convert a wordpress blog into Drupal. Finally found yours which lead to the Wordpress Import Plugin.

It's now version 6.x-1.0 so I'm really happy. I will try it and if I'm not here again, it's successful.

Thanks again,

thanks so much

I'm currently using Wordpress for a few of my Tukang Nggame sites but looking to change one of them over to drupal, thanks for the great article.

I've had a look at Drupal and

I've had a look at Drupal and it looks pretty good. I currently run my discount codes site on WP. What advantages would Drupal give me?

Sorry if that sounds like I'm being picky, I'm not. I'd just like a heads up on the advantages.

Google AdSense

Dear Friends. What are the drawbacks to using Google AdSense?
I have already gogle ad sense Ads on my webpage but I dont have readers click my ad on my blog either. I think ive made about $0.70 today. Thats pretty bad....

Wordpress import faster & better

Just a little note to readers who are considering migration from Wordpress to Drupal : the Wordpress Import module has evolved a lot since this blog post. Version 6.x-2.x-dev is now much faster, supports blogs with thousands of posts and pages and has more features like organic groups. Make sure to look at the README for updated instructions.

You can get it here : http://drupal.org/project/wordpress_import

Problems with wordpress import

I have followed instructions as per post and managed to export my wordpress db to the correct format, however when I try and import it into my clean installation of Drupal I get a bunch of errors and exceptions with it finally saying that my file is not in the correct format.

Can anyone help?
I am willing to also pay for someone to do this for me



Generally the scripts for

Generally the scripts for doing Wordpress imports are designed to work with the Wordpress export file (an XML file) and not the database directly. It's not clear from your comment if you're needing to use the database directly?

If you do need to use the database directly you might want to look at the Migrate module.

I'm having so much problems

I'm having so much problems with this. Is there any further documentation or support? Would really appreciate it. Thanks


Wordpress Theme to Drupal

Hi, Ive been working in Drupal fro almost a year and with all the under the bonnet modules i do not wish to change to another CMS system, however the template i have been editing to exactly what im looking for visually is a wordpress theme. Been poking away at this for weeks trying to convert into a Drupal theme but my wordpress knowledge is limited and i have tried everything from online information.

I would be more than happy to pay a designer to undertake this task, for more information on the template please contact me at theboxinghistorian@gmail.com

I have the currebt te,plate online to where you could view.

RSS difficulties

The so-called eXtended RSS (WXR) method by way of wordpress_import module has failed on me, and I think it has to do with number of posts. I have a single-user blog but posts dating back a few years, resulting on a 5+ MB RSS file.

I think the sheer volume crashes the drupal module (yes, I have edited file size settings in php.ini to allow larger than 5MB uploads), or causes Wordpress to export a corrupt RSS file.

I am going to try the wp2drupal way next, even though it only supports Drupal sites as old as 4.7.x, mainly because it doesn't circumvent the databse and also migrate user and privacy settings etc. Wish me good luck!

I'm upgrading from b2, the infamous predecessor of Wordpress itself:)

A third alternative

By the way, here's a third way; import data into CCK Nodes: http://drupal.org/node/133705

Unless you know your way around mysql of course:)

Thanks for the overview.

Thanks for the overview.
I really love to promote great design

I really found some good

I really found some good amount of contents and creative writing abilities in this blog which has been inspired me for blogging, it's have been a good experiment to migrating a Wordpress site to a Drupal. I have been using Wrodpress but I think this is the perfect way to move towards Drupal.

Unless you know your way

Unless you know your way around mysql of course:)

The post is pretty

The post is pretty interesting. I really never thought I could have a good read by this time until I found out this site, I found it was a simple process for being migrated Wordpress to Drupal 6, but could you make a process for the migration of Drupal 7?

Seems hard, but...

I love wordpress: it's easy and simple... You can find theme templates all over the internet and lots of free useful plugins. So, it seems a improbable that I migrate wordpress to drupal! But I've an open mind and in the past I've changed my mind quite a few times... And this post made me curious about drupal. Is it better? What are the advantages compared to WP?

How about a video tutorial

This is a very nice tutorial for people who want to migrate to drupal. But why don't you do a video tutorial? It's completely different reading and seeing it being done... Well, at least for me (I'm a total rookie in this stuff).