Drupal to WordPress migration SQL queries explained

In this post I will give a step-by-step explanation of my Drupal to WordPress migration SQL queries. For general information about migrating from Drupal to WordPress, please see instead my Drupal to WordPress Migration Guide.

Drupal to WordPress migration queries screenshot

Since I offer site migration as a paid service, readers might be wondering why I’m giving away some of my secret sauce. The simple answer is that the ingredients of the sauce are anything but secret. A web search brings up blog posts and tutorials detailing how to go about it. In fact, the first version of my own Drupal to WordPress migration tool was based on a blog post by another web company.

However, while the knowledge is freely available, the whole process can be a real pain, especially when you’re dealing with a Drupal installation with lots of content and customisations. In my experience, migrating an established site from Drupal to WordPress requires all of the following:

  • An intermediate to advanced level of technical skill;
  • Time to plan, run the migration and do post-migration clean-up;
  • A great deal of patience.

If you are a developer with the right skills, you still need to consider the time investment and effort needed to understand both Drupal and WordPress database schemas. Often, the man-hours required will make a client think twice about proceeding with the project. Fortunately (or unfortunately) for me, I’ve needed to put in the time because my maintenance agreement for some clients covered exactly this sort of work. I’ve therefore built up enough experience to offer competitive quotes for migration of even complex sites. In my very biased opinion, you’ll make better use of your time and budget by getting me to do the task!

Of course, there are still cases where, for whatever reason, it’s not viable to offload the work to someone else. If this sounds like your situation, you’ll probably figure things out eventually so I might as well help you along.

Prerequisites for the Drupal to WordPress migration script

To run this migration you will need:

  • A working installation of Drupal 6;
  • A clean installation of WordPress 3.5 or above;
  • Access to the Drupal and WordPress MySQL databases;
  • The ability to run SQL queries on both databases;
  • Both databases on the same MySQL server;
  • Access to the Drupal and WordPress installations.

Ideally, you should:

  • Run the migration from a development server (it’s best not to risk running this on your live server);
  • Backup your live Drupal database before beginning the migration;
  • Be comfortable with running database operations;
  • Have planned the migration beforehand (e.g. which content types and taxonomies should be migrated).

If you have an older version of Drupal, simply upgrade to Drupal 6 first, then run the migration. I mention WordPress 3.5 as a prerequisite because that’s where I’ve done most testing. You can probably get away with migrating straight into a more recent version but to avoid any problems, I suggest you start off with WordPress 3.5. It’s easy to upgrade to the latest WordPress version after converting the Drupal content.

The Drupal to WordPress migration SQL queries

Keep in mind that this article is based on my Drupal to WordPress migration tool but with some additional queries written for the specific needs of a client. It therefore includes some values which will not apply to your site. I’ve stripped out any identifying information but left generic data to provide an example. You will need to manually look up the correct values in the Drupal database for your installation.

Another thing to keep in mind is that I’ve favoured readability over efficiency. For example, it’s possible to write more complex queries to avoid creating working tables but that would make debugging more difficult. Having a trail of data changes can help with content analysis if the end results aren’t what you expected.

CAUTION: Make a backup of both your Drupal and WordPress databases before running these queries. USE IS ENTIRELY AT YOUR OWN RISK. I’m offering this information with no warranty or support implied.

Example data in this scenario

  • wordpress: the WordPress database name.
  • drupal: the Drupal database name.
  • acc_ table prefixes: these are working tables I create to help with migrating data.

Clear out some Drupal and WordPress tables

For most migration projects to date, I’ve needed to run through several passes of the queries as I make incremental adjustments based on the client’s feedback. I define a ‘pass’ as one iteration of the entire migration process and inspecting the results in a WordPress installation. Depending on your project requirements, you may need to do this several times, making little tweaks to the MySQL queries as you go along.

These Drupal and WordPress tables may be empty or non-existent if you’re running the queries for the first time but it makes sense to clear them out at the start.

TRUNCATE TABLE wordpress.wp_comments;
TRUNCATE TABLE wordpress.wp_links;
TRUNCATE TABLE wordpress.wp_postmeta;
TRUNCATE TABLE wordpress.wp_posts;
TRUNCATE TABLE wordpress.wp_term_relationships;
TRUNCATE TABLE wordpress.wp_term_taxonomy;
TRUNCATE TABLE wordpress.wp_terms;
TRUNCATE TABLE wordpress.wp_users;

DROP TABLE IF EXISTS drupal.acc_duplicates;
DROP TABLE IF EXISTS drupal.acc_news_terms;
DROP TABLE IF EXISTS drupal.acc_tags_terms;
DROP TABLE IF EXISTS drupal.acc_wp_tags;
DROP TABLE IF EXISTS drupal.acc_users_post_count;
DROP TABLE IF EXISTS drupal.acc_users_comment_count;
DROP TABLE IF EXISTS drupal.acc_users_with_content;
DROP TABLE IF EXISTS drupal.acc_users_post_count;

For some installations, I make changes to the wp_usermeta table so that needs to be cleared too.

TRUNCATE TABLE wordpress.wp_usermeta;

Vocabularies and taxonomies

Delete unwanted vocabularies. You’ll need to look in your Drupal vocabulary table for the appropriate vids. In this case, I’m deleting vocabularies 5, 7, 8, 38 and 40.

DELETE FROM drupal.vocabulary WHERE vid IN (5, 7, 8, 38, 40);

Delete terms associated with unwanted vocabularies. Here I’m keeping the terms for vid 38. Sometimes you might want to keep some terms of unwanted vocabularies for later conversion into into WordPress tags. (Please see the next query.)

DELETE FROM drupal.term_data WHERE vid IN (5, 7, 8, 40);

You may want to merge terms. In this example, I am merging the previously saved terms for News which has vid 38 to the Tags vocabulary terms which has vid 2.

We will need to deal with duplicates. For example, in the Drupal installation, ‘science’ could appear in both News (vid 38) and Tags (vid 2). This will cause a problem when exporting to WordPress since we can’t have duplicate terms. Here I create working tables for both term groups.

CREATE TABLE drupal.acc_news_terms AS SELECT tid, vid, name FROM drupal.term_data WHERE vid=38;
CREATE TABLE drupal.acc_tags_terms AS SELECT tid, vid, name FROM drupal.term_data WHERE vid=2;

Create a working table from duplicates.

CREATE TABLE drupal.acc_duplicates AS
SELECT t.tid tag_tid,
n.tid news_tid,
t.vid tag_vid,
n.vid news_vid,
t.name
FROM drupal.acc_tags_terms AS t
INNER JOIN (drupal.acc_news_terms AS n)
ON n.name=t.name;

Append a string to News terms duplicates so they won’t clash during migration. Here I used a fixed string but this won’t work if you have more than two terms with the same name. If you expect many terms with the same name, it would be better to generate a unique number. For example, using the tid would make it unique since these are unique primary keys. Use whatever string makes sense for your project.

Note that we’re overwriting the source data in the Drupal term_data table so proceed with care. Make sure you have a backup of your pre-migration Drupal tables in case you need to run the conversion again.

UPDATE drupal.term_data
SET name=CONCAT(name, ‘_01’)
WHERE tid IN (SELECT news_tid FROM drupal.acc_duplicates);

Convert Drupal News terms to Drupal Tags. We’ll migrate the whole lot into WordPress tags later.

UPDATE drupal.term_data SET vid=2 WHERE vid=38;

Create a table of WordPress tags. Exclude any terms from Drupal vocabularies that you might later migrate into WordPress categories. See the MySQL queries below where I create WordPress categories and sub-categories.

Here, all Drupal vocabularies except 37, 36 and 35 will be converted WordPress tags.

CREATE TABLE drupal.acc_wp_tags AS
SELECT
tid,
vid,
name
FROM drupal.term_data
WHERE vid NOT IN (37, 36, 35);

Now create the tags in the WordPress database. A clean WordPress database will have term_id=1 for ‘Uncategorized’. Use REPLACE as this may conflict with a Drupal tid.

We are assuming that this point the Drupal term_data table has been cleaned of any duplicate names. Any duplicate terms will be lost when running this MySQL query.

REPLACE INTO wordpress.wp_terms (term_id, name, slug, term_group)
SELECT
d.tid,
d.name,
REPLACE(LOWER(d.name), ‘ ‘, ‘_’),
d.vid
FROM drupal.term_data d WHERE d.tid IN (
SELECT t.tid FROM drupal.acc_wp_tags t
);

In WordPress, tags and categories are all stored in the wp_term_taxonomy table. The taxonomy field specifies whether it’s a tag or category by setting the field string to either ‘post_tag’ or ‘category’.

Here I convert these Drupal terms into WordPress tags.

REPLACE INTO wordpress.wp_term_taxonomy (
term_taxonomy_id,
term_id,
taxonomy,
description,
parent)
SELECT DISTINCT
d.tid,
d.tid ‘term_id’,
‘post_tag’, /* This string makes them WordPress tags */
d.description ‘description’,
0 /* In this case, I don’t give tags a parent */
FROM drupal.term_data d
WHERE d.tid IN (SELECT t.tid FROM drupal.acc_wp_tags t);

Create the categories and sub-categories in the WordPress database. This may be unnecessary depending on your setup.

Add terms associated with a Drupal vocabulary into WordPress. Note that in this case, these are the same vids that I excluded from the tag table above.

REPLACE INTO wordpress.wp_terms (term_id, name, slug, term_group)
SELECT DISTINCT
d.tid,
d.name,
REPLACE(LOWER(d.name), ‘ ‘, ‘_’),
d.vid
FROM drupal.term_data d
WHERE d.vid IN (37, 36, 35);

Convert these Drupal terms into WordPress sub-categories by setting the parent field in the wp_term_taxonomy table.

REPLACE INTO wordpress.wp_term_taxonomy (
term_taxonomy_id,
term_id,
taxonomy,
description,
parent)
SELECT DISTINCT
d.tid,
d.tid ‘term_id’,
‘category’,
d.description ‘description’,
d.vid
FROM drupal.term_data d
WHERE d.vid IN (37, 36, 35);

Now add the vocabularies to the WordPress terms table. There’s no need to set term_id as vocabularies are not directly associated with posts.

INSERT INTO wordpress.wp_terms (name, slug, term_group)
SELECT DISTINCT
v.name,
REPLACE(LOWER(v.name), ‘ ‘, ‘_’),
v.vid
FROM drupal.vocabulary v
WHERE vid IN (37, 36, 35);

Insert Drupal vocabularies as WordPress categories.

INSERT INTO wordpress.wp_term_taxonomy (
term_id,
taxonomy,
description,
parent,
count)
SELECT DISTINCT
v.vid,
‘category’, /* This string makes them WordPress categories */
v.description,
v.vid,
0
FROM drupal.vocabulary v
WHERE vid IN (37, 36, 35);

Update the WordPress term groups and parents.

Before continuing with this step, we need to manually inspect the table to get the term_id for the parents inserted above. In this case, vids 37, 36 and 35 were inserted as into the wp_term_taxonomy table as term_ids 7517, 7518 and 7519. I will use them as the parents for their respective terms. In other words, terms that formerly belonged to the Drupal vocabulary ID 37 would now belong to the WordPress parent category 7519.

UPDATE wordpress.wp_terms SET term_group=7519 WHERE term_group=37;
UPDATE wordpress.wp_terms SET term_group=7518 WHERE term_group=36;
UPDATE wordpress.wp_terms SET term_group=7517 WHERE term_group=35;

UPDATE wordpress.wp_term_taxonomy SET parent=7519 WHERE parent=37;
UPDATE wordpress.wp_term_taxonomy SET parent=7518 WHERE parent=36;
UPDATE wordpress.wp_term_taxonomy SET parent=7517 WHERE parent=35;

UPDATE wordpress.wp_term_taxonomy SET term_id=7519 WHERE term_taxonomy_id=7519;
UPDATE wordpress.wp_term_taxonomy SET term_id=7518 WHERE term_taxonomy_id=7518;
UPDATE wordpress.wp_term_taxonomy SET term_id=7517 WHERE term_taxonomy_id=7517;

Re-insert the Uncategorized term replaced earlier in the conversion process. We may have replaced or deleted the Uncategorized category during a previous MySQL query. Re-insert it if you want an Uncategorized category.

INSERT INTO wordpress.wp_terms (name, slug, term_group)
VALUES (‘Uncategorized’, ‘uncategorized’, 0);
INSERT INTO wordpress.wp_term_taxonomy (
term_taxonomy_id,
term_id,
taxonomy,
description,
parent,
count)
SELECT DISTINCT
t.term_id,
t.term_id,
‘category’,
t.name,
0,
0
FROM wordpress.wp_terms t
WHERE t.slug=’uncategorized’;

Converting Drupal nodes to WordPress posts

Now create WordPress posts from Drupal nodes. This may take a while if you have many Drupal nodes. Wait until the query completes before continuing. It could take several minutes.

REPLACE INTO wordpress.wp_posts (
id,
post_author,
post_date,
post_content,
post_title,
post_excerpt,
post_name,
post_modified,
post_type,
post_status,
to_ping,
pinged,
post_content_filtered)
SELECT DISTINCT
n.nid ‘id’,
n.uid ‘post_author’,
DATE_ADD(FROM_UNIXTIME(0), interval n.created second) ‘post_date’,
r.body ‘post_content’,
n.title ‘post_title’,
r.teaser ‘post_excerpt’,
IF(a.dst IS NULL,n.nid, SUBSTRING_INDEX(a.dst, ‘/’, -1)) ‘post_name’,
DATE_ADD(FROM_UNIXTIME(0), interval n.changed second) ‘post_modified’,
n.type ‘post_type’,
IF(n.status = 1, ‘publish’, ‘private’) ‘post_status’,
‘ ‘,
‘ ‘,
‘ ‘
FROM drupal.node n
INNER JOIN drupal.node_revisions r USING(vid)
LEFT OUTER JOIN drupal.url_alias a
ON a.src = CONCAT(‘node/’, n.nid)
WHERE n.type IN (
/* List the content types you want to migrate */
‘page’,
‘story’,
‘blog’,
‘video’,
‘forum’,
‘comment’);

Set the Drupal content types that should be migrated as WordPress ‘posts’. In this case, I want ‘page’, ‘story’, ‘blog’, ‘video’, ‘forum’ and ‘comment’ in Drupal to be converted to posts in WordPress.

UPDATE wordpress.wp_posts SET post_type = ‘post’
WHERE post_type IN (
‘page’,
‘story’,
‘blog’,
‘video’,
‘forum’,
‘comment’);

Now convert the remaining content types into WordPress pages.

UPDATE wordpress.wp_posts SET post_type = ‘page’ WHERE post_type NOT IN (‘post’);

Housekeeping queries for terms

Here I associate the content with WordPress terms using the wp_term_relationships table.

INSERT INTO wordpress.wp_term_relationships (
object_id,
term_taxonomy_id)
SELECT DISTINCT nid, tid FROM drupal.term_node;

We need to update tag counts.

UPDATE wordpress.wp_term_taxonomy tt
SET count = ( SELECT COUNT(tr.object_id)
FROM wordpress.wp_term_relationships tr
WHERE tr.term_taxonomy_id = tt.term_taxonomy_id);

Now set the default WordPress category. You’ll need to manually look in the database for the term_id of the category you want to set as the default WordPress category.

UPDATE wordpress.wp_options SET option_value=’7520′ WHERE option_name=’default_category’;
UPDATE wordpress.wp_term_taxonomy SET taxonomy=’category’ WHERE term_id=7520;

Migrate comments

REPLACE INTO wordpress.wp_comments (
comment_ID,
comment_post_ID,
comment_date,
comment_content,
comment_parent,
comment_author,
comment_author_email,
comment_author_url,
comment_approved)
SELECT DISTINCT
cid,
nid,
FROM_UNIXTIME(timestamp),
comment,
pid,
name,
mail,
SUBSTRING(homepage,1,200),
((status + 1) % 2) FROM drupal.comments;

Update comment counts.

UPDATE wordpress.wp_posts
SET comment_count = ( SELECT COUNT(comment_post_id)
FROM wordpress.wp_comments
WHERE wordpress.wp_posts.id = wordpress.wp_comments.comment_post_id);

Migrate Drupal Authors into WordPress

In this case I am migrating only users who have created a post. This was a requirement for my project but may be unnecessary for you.

First delete all existing WordPress authors except for admin.

DELETE FROM wordpress.wp_users WHERE ID > 1;
DELETE FROM wordpress.wp_usermeta WHERE user_id > 1;

Now set Drupal’s admin password to a known value. This avoids hassles with trying to reset the password on the new WordPress installation. Resetting a user password in WordPress is more convoluted and cannot be done using a simple MySQL query as in Drupal.

UPDATE drupal.users set pass=md5(‘password’) where uid = 1;

Create a working table of users and the number of posts they’ve authored. I am only considering authors who have created posts of the content types I want to migrate.

CREATE TABLE drupal.acc_users_post_count AS
SELECT
u.uid,
u.name,
u.mail,
count(n.uid) node_count
FROM drupal.node n
INNER JOIN drupal.users u on n.uid = u.uid
WHERE n.type IN (
/* List the post types I migrated earlier */
‘page’,
‘story’,
‘blog’,
‘video’,
‘forum’,
‘comment’)
GROUP BY u.uid
ORDER BY node_count;

Now add these authors into the WordPress wp_users table.

INSERT IGNORE INTO wordpress.wp_users (
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_registered,
user_activation_key,
user_status,
display_name)
SELECT DISTINCT
u.uid,
REPLACE(LOWER(u.name), ‘ ‘, ‘_’),
u.pass,
u.name,
u.mail,
FROM_UNIXTIME(created),
”,
0,
u.name
FROM drupal.users u
WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);

First set all these authors to WordPress “author” by default. In the next MySQL query, we can selectively promote individual authors to other WordPress roles.

INSERT IGNORE INTO wordpress.wp_usermeta (
user_id,
meta_key,
meta_value)
SELECT DISTINCT
u.uid,
‘wp_capabilities’,
‘a:1:{s:6:”author”;s:1:”1″;}’
FROM drupal.users u
WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);

INSERT IGNORE INTO wordpress.wp_usermeta (
user_id,
meta_key,
meta_value)
SELECT DISTINCT
u.uid,
‘wp_user_level’,
‘2’
FROM drupal.users u
WHERE u.uid IN (SELECT uid FROM drupal.acc_users_post_count);

During the course of the migration, some posts may end up not having an assigned author. Here I reassign authorship for these posts to the WordPress admin user.

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

Comment authors

In Drupal, comments are treated as nodes and comment authors are stored along with other node authors in the Drupal users table. WordPress treats comments and comment authors differently. Comment authors in WordPress are not stored in the wp_users table. Instead, they’re stored along with the comment content itself in the wp_comments table.

We may need to run additional query to import users who have commented but haven’t created any of the selected content types. To do this, I create some working tables required for some later MySQL queries:

  • acc_users_with_comments: empty copy of wp_users
  • acc_users_add_commenters: empty copy of wp_users
  • acc_wp_users: copy of wp_users from wordpress database containing users

Running the following MySQL queries will throw errors if you haven’t created the required tables above.

First create a working table of Drupal users who have created a Drupal comment.

CREATE TABLE drupal.acc_users_comment_count AS
SELECT
u.uid,
u.name,
count(c.uid) comment_count
FROM drupal.comments c
INNER JOIN drupal.users u on c.uid = u.uid
GROUP BY u.uid;

Now add the author information for these users into another working table.

INSERT IGNORE INTO drupal.acc_users_with_comments (
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_registered,
user_activation_key,
user_status,
display_name)
SELECT DISTINCT
u.uid,
REPLACE(LOWER(u.name), ‘ ‘, ‘_’),
u.pass,
u.name,
u.mail,
FROM_UNIXTIME(created),
”,
0,
u.name
FROM drupal.users u
WHERE u.uid IN (SELECT uid FROM drupal.acc_users_comment_count);

Using the above table, next build a working table of Drupal users who have commented but have not already been added to the WordPress wp_users table.

INSERT IGNORE INTO drupal.acc_users_add_commenters (
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_registered,
user_activation_key,
user_status,
display_name)
SELECT DISTINCT
u.ID,
u.user_login,
u.user_pass,
u.user_nicename,
u.user_email,
u.user_registered,
”,
0,
u.display_name
FROM drupal.acc_users_with_comments u
WHERE u.ID NOT IN (SELECT ID FROM drupal.wp_users);

Combine the tables into another working table acc_wp_users.

INSERT IGNORE
INTO drupal.acc_wp_users
SELECT *
FROM drupal.acc_users_add_commenters;

The acc_wp_users working table helps when inspecting the user list. For example, you might want to clear out inactive users or spam posters. Once finished, remember to replace your WordPress wp_users with the cleaned acc_wp_users table. You may prefer to amend the above query to insert directly into the WordPress wp_users table.

I realise this is a rather round-about way of migrating comment authors from Drupal into WordPress but find that having working tables helps with debugging.

Housekeeping for WordPress options

Update file path for the WordPress installation.

UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content, ‘”/files/’, ‘”/wp-content/uploads/’);

Set your WordPress site name using the Drupal ‘site_name’ variable.

UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name=’site_name’) WHERE option_name = ‘blogname’;

Set your WordPress site description using the Drupal ‘site_slogan’ variable.

UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name=’site_slogan’) WHERE option_name = ‘blogdescription’;

Set the WordPress site email address.

UPDATE wordpress.wp_options SET option_value = ( SELECT value FROM drupal.variable WHERE name=’site_mail’) WHERE option_name = ‘admin_email’;

Set the WordPress permalink structure. Here we’re using /%postname%/ but you may set it according your own needs.

UPDATE wordpress.wp_options SET option_value = ‘/%postname%/’ WHERE option_name = ‘permalink_structure’;

Create URL redirects table

This table will not be used for the migration but may be useful if you need to manually create redirects from Drupal aliases. You will need the entries here for search engine optimisation (SEO) of your new WordPress site.

DROP TABLE IF EXISTS drupal.acc_redirects;
CREATE TABLE drupal.acc_redirects AS
SELECT
CONCAT(‘drupal/’,
IF(a.dst IS NULL,
CONCAT(‘node/’, n.nid),
a.dst
)
) ‘old_url’,
IF(a.dst IS NULL,n.nid, SUBSTRING_INDEX(a.dst, ‘/’, -1)) ‘new_url’,
‘301’ redirect_code
FROM drupal.node n
INNER JOIN drupal.node_revisions r USING(vid)
LEFT OUTER JOIN drupal.url_alias a
ON a.src = CONCAT(‘node/’, n.nid)
WHERE n.type IN (
/* List the post types I migrated earlier */
‘page’,
‘story’,
‘blog’,
‘video’,
‘forum’,
‘comment’);

Finalising the conversion

Now that we’ve finished converting the content over from Drupal to WordPress, we have the rather (not very) fun job of checking the content, setting up any WordPress plugins and widgets, then finally going live. Depending on the complexity of your Drupal installation, this process can be extremely time-consuming and perhaps form a separate project in its own right.

You can use my Drupal to WordPress migration notes to help with going live. Of course, the search for equivalent WordPress plugins and conversion from the old Drupal modules will have to be done according to your specific set-up.

Accepting limitations

Before finishing this article, one point I’d like to convey is the importance of accepting the limitations of any migration process. You, or your client, may be insistent on turning your new WordPress site into an exact copy of your former Drupal installation. While this may be technically possible, there comes a point of diminishing returns where the work you’d need to put in just isn’t worth the value of the data.

It may also be more productive in some instances to make manual adjustments via the WordPress control panel than to try anything clever using the backend database. Sometimes the time needed to write, test and debug MySQL queries far exceeds the boring but more reliable editing using the web-front end.

Expect to kill your SEO if you’re not careful with the migration. A site that relies heavily on revenue from search engine rankings will need extra steps to preserve SEO. This is a huge topic so I will not cover it here but you should carefully plan the conversion steps before starting with the migration. Pay particular attention to preserving Drupal path aliases, taxonomy listing pages and internal links.

Good luck!

So that’s it. A Drupal to WordPress migration can be a great deal of effort. I’ve had one project that initially looked like only couple of hours work balloon to over 50 billable hours in total. Previously installed modules caused problems requiring custom MySQL queries and PHP scripting to resolve. On the other hand, I’ve had a number of sites that completed in 15 minutes after running my Drupal to WordPress migration tool.

Overall, the majority of my clients prefer WordPress over their previous Drupal site. I personally find WordPress quicker to update and manage. Any short-term hassles with migrating have been outweighed by the long-term advantages of easier maintenance.

Getting the code and submitting improvements

You can find the code on my GitHub repository. The queries in this article can be found in the file drupaltowordpress-custom.sql.

I’d love to receive corrections, bug fixes and suggestions for improvements. Please contact me or submit an issue on GitHub.

CAUTION: Make a backup of both your Drupal and WordPress databases before running these queries. USE IS ENTIRELY AT YOUR OWN RISK. I’m offering this information with no warranty or support implied.

2 thoughts on “Drupal to WordPress migration SQL queries explained”

  1. Pingback: A little more on Drupal vs WordPress

  2. Pingback: Migrating from Drupal 6 to Wordpress - Pat Heyman

Comments are closed.

Scroll to Top