How To Convert Drupal To WordPress

After hunting down some tutorials and finding some missing important parts, no explanations, and being disappointed, I had to do some experimenting. As a developer, I do not mind solving a challenge and putting puzzles together. There were some decent tutorials, however, I found that once I completed my own Drupal to WordPress conversion, I needed to share the process in the easiest way possible.

Some of the issues I ran into were questions that other developers had with whether tables could be converted over as well as users. In fact, a lot of the questions I saw were over the user conversion from Drupal to WordPress. Also, this was a problem that was not addressed in some of the tutorials. Some of the scripts did not properly work, or did not have anything about converting over users.

I found issues with the categories and tags not being translated over to the correct taxonomy when doing my conversion. In fact, they were all slopped into the tags. My solution is before converting to make sure in the original Drupal install that these taxonomies are correctly labeled. Tags are non-hierarchical and Categories are hierarchical.

Another big problem was running into duplicate errors when feeding the SQL through the conversion process. The solution for this was to check the last known table that was converted over and only convert from after that table. It was tedious, especially since my conversion was for 17,000 posts and over 2,500 users.

This post goes over how to convert the database, and a little bit about converting the theme. Note: This will work for converting up to the 6.0+ version of Drupal.

Convert Drupal To WordPress: The Database

1. Export the Drupal SQL file from the old host.

2. Install a fresh new WordPress site. You need to clear the tables with the TRUNCATE command by going into your database’s SQL queries tab in phpmyadmin. The code is:

Replace the wordpress before the period with the database table name before executing the query. In the case you are doing the query from that WordPress database directly, you do not need the wordpress and the period in the code when executing the script.

3. If you have multiple users to convert over, you will need to use the following code.

Again, replace the wordpress before the period with the database table name before executing the query.

4. The following query will convert over tags:

5. The following converts over posts.

Please note that if your Drupal installation has several post types, you will want to add the name of the post type into the to the line that says WHERE n.type IN (‘post’, ‘page’, ‘blog’). If you do not add all post types, then not all will be converted over.

6. In the case you want to combine post types in WordPress. Say you wanted post and blog together, you would put the following code:

7. The following code defines the post/ tag relationship

8. The following code is for comments:

9. If you are keeping your Drupal images and filed in the same place, you do not have to do anything. However, if you are FTP-ing your files to the uploads folder in your WordPress wp-content folder, you will want to use the following script to fix the URLs to the images.

10. The following code is suppose to help fix taxonomy… that is if it was set up correctly in the original Drupal site.

11. Author roles for your users:

This sets the author role’s permissions.

You may want to uncomment (remove the number sign) before the line that has the email address and put your own in so your role remains as an administrator.

12. Assign and give administrator status.

13. The following code helps assign authors to the posts they wrote.

UPDATE wordpress.wp_posts
SET post_author = NULL
WHERE post_author NOT IN (SELECT DISTINCT ID FROM wordpress.wp_users)

14. Depending on how the original Drupal site has been set up, sometimes the URLs are funny, try feeding the following query. It does not hurt to try.

15. The following is some extra clean up for the editor so your posts do not look too funky from the conversion.

There are quite a few other options, but I found these the most necessary for my install. In the case you want to look through for more options, you can check out the Drupal to WordPress Migration at the Underdog of Perfection.

I did run into one last thing that was a problem. Once I had everything over, I went to click on the individual posts and pages. I did already set the permalinks to postname. However, the links kept redirecting back to the home page. I had to update the slugs.

To do so, you need to put the following code in the wp-config.php file before the ending PHP tag. Once you have, click save and then reload the front of your site. The script will run and should not take long at all. Once the front of your site loads, go back into the wp-config.php file and remove the code.

Convert Drupal To WordPress: The Theme

If you are familiar with, HTML, PHP, CSS, WordPress theming, and Drupal theming, great! You should know that the concepts of theming in WordPress are similar in Drupal. You design the theme, and in the parts that you want WordPress to do the work, like pages, posts, and widgets, you place the code with the coordinating loop and dynamic sidebar PHP call to those areas. If you are not familiar with theming, you can refer to my podcast presentation that includes a slideshow on PSD to WordPress, which delves a little deep into WordPress theme templates.

You can literally remove all the codes for modules and such from the Drupal theme templates and replace with the WordPress code.

I hope this helps explain the steps to convert Drupal to WordPress. This should world in at least Drupal 6 to WordPress 3.5. Please use at your own risk and always have a back up before you remove anything for good.

This is where YARRP will go

About Nile

Nile is a 33 year old female from Southern Illinois. Nile is a mother of 1 son. She is also a web designer and developer, a graphic designer, and a public speaker, who exclusively designs and develops using WordPress. She is currently a student working for a Bachelors in Business. She also blogs at and her very personal site, Click to read more about Nile and


  1. Great informative site, i appreciate you…I am a new reader on this site, am happy to read many post…Thank you so much..

  2. Hi Nile,
    thank you very much indeed for these easy-to-use steps and clear explanations. To be honest, I am fascinated with your ability to find simple words for explaining these complicared issues. Thank you very much once again.

  3. Thanks for giving useful steps for conversion .I have found many useful tips here

  4. Wow..i just can say that these kind of explanations are very very helpful. I work with WordPress and I was wondering if there was a way to convert WordPress to Drupal. Like you said, there are some tutorials but this explanation is very good and i like to hear it from you if it is possible. Tnx

    • Hi Aleksandar! I am pretty sure there is a way to do the opposite and much of it would most likely be using the same code above, but opposite on the query commands. However, I normally convert sites to WordPress, because it is much easier for people.

  5. I heard that drupal was alo a big deal in the blogosphere, but I never used it, I won’t really be needing this since I rarely find look for any drupal themes

  6. Oh My Gosh!

    I wouldn’t wish this on anyone. I don’t know nothin’ bout no Drupal and hope I don’t ever have to convert it to WordPress!

    But Thanks for sharing anyways!


    ~ Jupiter Jim

    (please delete the parentheses — Nile, don’t worrry, this ain’t my comment for the week. Just had to share this thought!)

  7. I think with this tutorial you’ll make a lot of drupal users happy.

  8. Hmmm….converting from drupal to wordpress. The first thing you must do is BACKUP your drupal site before you try this. This is because something unpredictable could happen during conversion.

  9. Hello,

    Thanks for the informative post. I will try the same and if will need any further guidance will approach you.

    Thanks and Regards,
    Nishant Desai | SEO Expert India

  10. I like the method you used to explain this from one step to another. I really appreciate your good work here.

  11. Thank you so much for this article! I right now use both Drupal and WordPress in their own separate worlds, but if I ever need to convert, I know where to go to! Bookmarked! Thanks again!!

  12. Wow! Thank you so much.. you’re a real lifesaver. I had a client today who came to me with his Drupal site and a wanted me to edit the site for him, but I was totally clueless about Drupal. Got it converted to WordPress thanks to you! Keep on rocking :-)

  13. Kind of a lengthy process, but worth it in the end. Still a lot easier than what it was in the 90’s. That time was pure chaos for web developers.

  14. Not familar with Drupal, looks like a nightmare doing this though. Some sites we have are Joomla sites and I’m not a fan. It’s more sophisticated but not as simple :-p

  15. Very useful and informative post about how to convert the drupal to wordpress.

  16. Ahhhh!!! you are so professional!!! Check my site and give your uneasy so i can fix it!

  17. Whoa! Thanks a lot a great deal.. you’re a true lifesaver. I’d a customer at the moment whom located anyone together with his Drupal web site and a noticeably necessary anyone to switch the website meant for him or her, web hosts on the other hand I has been totally clueless concerning Drupal. Started using it turned into WordPress on account of somebody! Proceed rocking.

  18. This was a LIFE SAVER. I was at the brink of going crazy trying to figure this out. Thank you so much!

  19. thanks for sharing this info! It’s awesome! the fact that you really share this instead of just keep it to yourself or make money…
    The truth is, I am not capable of doing anything more than publishing content on my Drupal site, cause I am afraid to break something (which happened several times already) But I’ve found a tool at that migrates Drupal to WordPress like without any efforts on my site and for free (this is the weirdest thing:)
    Do you think I can try it?
    Sorry, but your wonderful script is something too complex for me to use…

    • I am sure you can try it out. It seems to be in beta version. If you do try it out and it works great, let me know. :) Just make sure to have a backup of your original Drupal site before trying the migration. :)

      The script is one that is open source and worked for me from scripts that had some missing areas. I am just sharing my experience and hope it helps.

  20. You did it again Nile! Great Post! Thank you!

  21. As wordpress provides all the features without any head ache of coding. I don’t have any idea about Drupal but I think wordpress is best at this time.

  22. I would like to say you nothing more than a Thanks. I was looking for a tutorial to covert one of my website from Drupal to WordPress and Got it. Thank you.

  23. Great informative site, i appreciate you…I am a new reader on this site, am happy to read many post…Thank you so much..

  24. hello Nile..
    I never used drupal yet ,But I learn converting procedure for my future.May be this will be very helpful to me in future.Thanks for nice sharing.

  25. I haven’t used drupal as I am always connect with wordpress. As it is the nice interface for blogging. Thanks for this tutorial for converting drupal to wordpress.

  26. I am a new user to this blog. so informative. i learned few methods from your site. Drupal is another CMS like wordpress. but i am completely new to this. anyway it will be useful in future. i will practice with this. thank you

  27. Arghh… I wish I had come across this before moving my site over. I’ve already populated a lot in WordPress, but I still want to import my older Drupal articles into WP.

  28. Hi – I am a newbie to wordpress. I’m happy to have found this tutorial but I have a really basic question. I want to make sure I follow the steps correctly.
    1) So When I export the Drupal database, I’m assuming that I I then import it to the fresh wordpress install? Or I make the truncation changes on the database before importing it to wordpess?

    • You will want to have the drupal tables on the same web hosting account as your WordPress install before converting over… that is why you have to label your database tables properly in order to do the conversion. You don’t have to have the Drupal database in the same exact database as WordPress… just the same web hosting account’s MySQL. So if i were converting here, I’d more than likely put my drupal database in blondish_drpdb and convert it over to blondish_wrdp as an example.

      • Thank you for the clarification. You are extremely helpful. But just to be sure…

        1) copy the original database and place it in the wordpress site.
        2) Does the fresh wordpress install have to happen AFTER putting the database there? I already installed WordPress.
        3) make of copy of that original database and make the changes to the new database as listed above – so that there is an original drupal database and a modified/converted wordpress database on the same site.

        Please excuse my “blondness” :) (I use to be anyway…)

        • Hi Heather!

          You do not have to put the Drupal database into the same database as WordPress. You can create a new mySQL database and import the database through MySQL.

          However, if you do want to convert the Drupal database in the same one as WordPress, just import the sql or compressed sql file of the Drupal database into the WordPress one. Now, once you are done converting, you can select the Drupal tables and drop them. You may need to take notes on what tables to actually drop so you don’t accidentally delete a WordPress table.

          You don’t have to have a fresh install of WordPress when you are done converting, but like I said above, and recommend… remove the Drupal tables if you are indeed working in the same database account as your WordPress installation. I hope that helps.

  29. Yes, that helps. Thanks again. Okay… so here I go…! Wish me luck. I’ll report back soon. :)

  30. Wait – so the first part – deleting the users greater than 1, doesn’t make sense to me. Why would I do that? Sorry… but I have the users already listed just fine so I don’t understand why I should delete them…

    • This is to remove the users. If you have users in drupal, you will need to remove any that you have in WordPress except for 1, which is your admin. If you don’t have more than one, you can skip this step.

  31. Thank you so much! This was exceptionally helpful.

  32. I can call myself an expert in Drupal and PHP, but I haven’t worked on any conversions yet, as I do have a separate team working on stuffs like that.

    I will pass over this info to my team, might be of use in the future. But most of my customers come in to get converted to Drupal and not otherwise. But I loved reading this post as you are so precise with your steps in conversion.

  33. Hi there,
    I used your SQL to import the “posts” and “pages” into WordPress. When I go into wp-admin, everything is listed under pages, and nothing is under posts. In the wp-db, post_type correctly contains all the types from drupal, “blog, image, story, etc” any thoughts?


    • also, any tips for getting images into the media library?


      • You could move the images to your uploads folder and change the links to direct the path there as per one of the steps. The only issue is that you will not be able to manage them in the Media Library unless you load them from the WordPress admin.

    • You have to either register a custom post type in WordPress, OR, you will have to change in your Drupal database the line for the post type. blog and story are normally for post.

      • Hi thanks for replying. But it doesn’t explain why everything is listed as a page in wp. What is the correct value for a “post” and “page”? In your code example above it might be useful to indicate that “WHERE n.type IN (‘post’, ‘page’, ‘blog’)” will certainly pull the content, but it won’t correctly produce posts in wp. wp expects post_type=’post’ to display as post and you’ll have to convert everything else to ‘post’ or register the custom post_types.
        Additionally, images are stored as:

        Thanks for the article, it definitely helped jump start the process. :)

        • If you don’t want blog, don’t put it in your MySQL. post_type for posts are ‘post’ and ‘page’ for pages. If you want other post_types like image or other, like blog, you can still carry those over, BUT… you are going to have to create a custom post type (register it in your themes functions.php or install the Custom Post Types UI plugin) for blog or story, or anything else.

  34. Thank you – the sql excerpts were fantastic.

  35. Thanks so much for the article.

    I’ve attached an updated sql query from inserting posts & pages from drupal 7 –> wordpress 3, for posterity’s sake.

    You’ll need to change one of the IF statement in the select clause to make sure the correct drupal node type turns into a post (our node type was “article” in drupal):

    INSERT INTO wordpress.wp_posts
    (id, post_author, post_date, post_content, post_title, post_excerpt,
    post_name, post_modified, post_type, post_status)
    n.nid id,
    n.uid post_author,
    FROM_UNIXTIME(n.created) post_date,
    rb.body_value post_content,
    n.title post_title,
    rb.body_summary post_excerpt,
    IF(SUBSTR(a.alias, 11, 1) = ‘/’, SUBSTR(a.alias, 12), a.alias) post_name,
    FROM_UNIXTIME(n.changed) post_modified,
    IF(n.type = “article”,”post”,n.type) as post_type,
    IF(n.status = 1, ‘publish’, ‘private’) post_status
    FROM drupal.node n
    INNER JOIN drupal.node_revision r
    INNER JOIN drupal.field_revision_body rb ON rb.entity_id = r.nid
    LEFT OUTER JOIN drupal.url_alias a
    ON a.source = CONCAT(‘node/’, n.nid)
    # Add more Drupal content types below if applicable.
    WHERE n.type IN (‘article’, ‘page’)

  36. Abdul Moiz


    This is a great post, I am about to convert a very very heavy website to WordPress, I hope I can do it. Is there any way I can be in direct contact with your via Email or something like that.

    • Hi Abdul! If you’re asking me to consult with you even through email for your Drupal to WordPress conversion, I do charge per hour – $50/hour flat rate. You’re welcome to use my contact form to ask, but I’m no longer answering questions via email for free because I’ve had to give up time in the past.

Speak Your Mind


CommentLuv badge