How to Migrate a WordPress Site to Drupal

Leave your reply


Learn how to migrate a WordPress site to Drupal using the WordPress Migrate Drupal module. This module is built on top of the all-purpose Migrate module for migrating content into Drupal, and is designed to convert a WordPress blog export (WXR file) into a Drupal site, create Drupal taxonomies, build user accounts, format comments, and more.

This tutorial includes step-by-step instructions for the export of a WordPress site, the installation of Drupal, the installation of the WordPress Migrate plug-in and the import of a WordPress Site.


  • An existing WordPress site.
  • A server running Linux (CentOS 7 or Ubuntu 14.04)

Export the WordPress Site

Log into the admin area. Click Tools > Export.

Wordpress to Drupal 1: Export Wordpress data

Select All Content then click Download Export File. Save the file to your computer.

Wordpress to Drupal 2: Download export file

Create a Backup

We recommend that you create a full-site backup by downloading the entire contents of your main website directory via FTP. This will allow you to "roll back" the migration if you need to.

If you run into a problem with the Drupal migration, simply delete all of the Drupal files and upload new copies of the original files.

Install Drupal

Use the following steps to install Drupal into the same directory where the WordPress site is located. This will cause your WordPress site to become unavailable.

After Drupal has been installed, you will still be able to access your WordPress admin panel ( However, the website itself ( will only show the new Drupal site.

Because of this, it is best to perform this migration when traffic to your site will be low, and when you will have ample time available to address any problems which may arise during the migration.

Before you proceed, be sure that you have backed up all of your WordPress files.

Verify Server Requirements

Drupal 7 has a number of server requirements. Most up-to-date Cloud Servers running Linux will meet or exceed all of Drupal's requirements, but it is wise to check these before you install Drupal.

Check the PHP Version

Drupal 7 requires PHP 5.2.5 or higher. To check your PHP version, from the command line, go to your web directory and create a phpinfo.php file:

sudo nano phpinfo.php

Put the following into this file:


Note: For security purposes, delete this file after you are finished checking the PHP version.

Save and exit the file, then view the file in a web browser. The PHP version will be displayed at the top of the page.

php version

In the above example, the server is running PHP version 5.4.16.

Check the MySQL/MariaDB Version

Drupal 7 requires MySQL 5.0.15/MariaDB 5.1.44 or higher. To check your version of MySQL/MariaDB, log into the client with the command:

sudo mysql -u root -p

The version number will be displayed in the welcome message.

MySQL version

In the above example, the server is running MySQL version 5.5.47.

Check the Apache Version

Drupal 7 requires Apache version 1.3 or higher. You can find your version of Apache with the following commands:

CentOS and Red Hat:

sudo httpd -v

Ubuntu and Debian:

sudo apache2 -v

This will return information about your Apache server.

Apache version

In the example above, the server is running Apache version 2.4.6.

Download and Unpack the Drupal Software

Once you have made sure that your server meets the requirements for Drupal 7, the next step is to download the software and unpack it on your server.

Connect to your server using SSH, and go to your website's document root. Download the current release from the Drupal website by using the command:

sudo wget [download URL]

To find the download URL, visit the current release page on the Drupal website. Go to the "Recommended release" for Drupal Core 7.x.

On the next page, copy the "Download .tar.gz" link. To do this, right click on the download button and choose "Copy link location." You can then paste this URL into the command line by clicking Shift + Insert.

For example, to download the current stable release of Drupal 7 as of this article's publication (Drupal 7.50) the command is:

sudo wget

Unpack this file using the command:

sudo tar --strip-components=1 -xvzf [file name]

Tip: You can use tab completion to make this process easier. Type sudo tar -xvf drup then hit Tab. The shell will automatically fill out the rest of the file name on the command line.

For example, to unzip the file downloaded above, the command is:

After the contents of the Drupal file have been unpacked, set the ownership of the files to the Apache user:

CentOS 7:

sudo chown -R apache:apache *

Ubuntu and Debian:

sudo chown -R www-data:www-data *

You can now delete the .tar.gz file:

sudo rm [file name]

In this example, the command is:

sudo rm drupal-7.51.tar.gz

Create the Database

Next, you will need to create a database. Connect via SSH to your server and log in to MySQL/MariaDB with the command:

sudo mysql –u root –p

After you enter the MySQL/MariaDB root user password, you will be logged into the MySQL/MariaDB client.

Create a database with the command:

CREATE DATABASE [database name];

Replace [database name] with the name you want to use for your new database. For example, if you wanted to name your database my_drupal_site the command would be:

CREATE DATABASE my_drupal_site;

Create a user for this database and grant all privileges with the command:

GRANT all ON [database name].* TO [database username]@localhost IDENTIFIED BY '[database user password]';


  • [database name] with the name of your database.
  • [database username] with the username you want to create for your database.
  • [database user password] with a password for this user. Note: Be sure to give the user a strong password.

For example, to create a user named my_drupal_user with the password Fr4i*Re!2 and give the user privileges on the my_drupal_site database, the command would be:

GRANT ALL ON my_drupal_site.* TO my_drupal_user@localhost IDENTIFIED BY 'Fr4i*Re!2';

Once you have finished, exit the database with the command:


Complete the Installation

Next, switch to a browser and go to your website. You will see the Drupal installation page. Select Standard then click Save and Continue.

Install Drupal: Installation Page

On the next page, click Save and Continue.

Install Drupal: Installation Page

On the next page, select MySQL, MariaDB, or equivalent, then fill out the details of the database name, database user, and password which you created in the previous step. Then click Save and Continue.

Install Drupal: Installation Page

On the next page, you will be asked to fill in some website details and create a Drupal Site Maintenance (admin) account. Fill out all the required fields, then scroll down and click Save and Continue.

Install Drupal: Installation Page

Now that the installation is complete, you can go to your main website and begin using Drupal 7.

Install Drupal: Installation Page
Wordpress to Drupal 6: Get download URL

Right-click on the .tar.gz download link and copy the URL.

Next, log into your Drupal site using your administrative login and click Modules on the top site stripe.

Wordpress to Drupal 3: Click Modules

On the Modules page, click Install New Module.

Wordpress to Drupal 4: Install new module

Paste the URL for the .tar.gz download into the Install from a URL field and click Install.

Wordpress to Drupal 7: Install from a URL

Repeat this process to install the WordPress Migrate module, using the download URL on the WordPress Migrate Drupal Project page.

As a final step, you will need to enable the modules. Return to the Modules page and scroll down to the Migration section, where the Migrate-related module are listed.

Tick the boxes to select the Migrate, Migrate Example, Migrate UI, and Migration from WordPress module, then click Save configuration.

Wordpress to Drupal 8: Save configuration

Migrate the WordPress Site

Create a Private Directory

First you will need to create a directory for storing your private files. For security reasons, Drupal recommends that this directory be created outside your website's document root.

For example, if your website's document root is /var/www/ you could create a directory /var/www/ To do this from an SSH session, use the command:

sudo mkdir /var/www/

CentOS 7:

sudo chown -R apache:apache /var/www/

Ubuntu 14.04:

sudo chown -R www-data:www-data /var/www/

Edit the php.ini File if Needed

If the WordPress export XML file is over 2MB, you will need to edit your server's php.ini file to allow larger file uploads. Otherwise, the migration will fail with the message that "The file could not be uploaded, most likely because the file size exceeds the configured limit of 2 MB."

The first step is to find the php.ini file. The easiest way to do this is to create a phpinfo.php page in your website's document root. In our example, the webiste's document root is /var/www/

sudo nano /var/www/

Put the following into this file:

<?php phpinfo(); ?>

Save and exit the file, then view it in a browser. It will list all of your server's PHP settings. Scroll down until you find the Loaded Configuration File section.

Wordpress to Drupal 15: Find php.ini file path
sudo nano /etc/php.ini

Scroll down until you find a section which says:

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Change the 2M value to a higher number. For security reasons, it is best to make it only high enough to upload your WordPress XML file, and no higher. You can always come back and edit this file in the future if you need to allow larger uploads.

For this example, we will double the maximum upload size to 4MB:

; Maximum allowed size for uploaded files.
upload_max_filesize = 4M

Save and exit the file, then restart the web server for the changes to take effect.

CentOS 7:

sudo systemctl restart httpd

Ubuntu 14.04:

sudo service apache2 restart

For security reasons it is best to delete the phpinfo.php page after you are done.   

Complete the Migration

In the Administration area of your Drupal site, click Content.

Wordpress to Drupal 9: Click Content

Click the Migrate tab.

Wordpress to Drupal 10: Click Migrate

Click Import from WordPress.

Wordpress to Drupal 11: Click Import from WordPress

You will need to configure a private file path for the upload. Click the link to go to the Configuration > Media page.

Wordpress to Drupal 12: Go to Configuration > Media

Enter the full path to the private directory which you created. Then click Save Configuration.

Wordpress to Drupal 13: Save Configuration

Your configuration will be saved, and you will be returned to the Migrate page. Click the Browse button to find and select the WordPress Export (WXR) XML file on your desktop computer, then click Next.

Wordpress to Drupal 14: Select WXR file

In the next step, Drupal will ask if you want to have your WordPress users imported, or assign all posts to a new Drupal user. Most people will want to leave this option set to Yes and click Next.

The next step is similar, and is in regards to WordPress authors. Once again, most people will want to leave this option set to Yes and click Next.

Wordpress to Drupal 16: Import authors

Next, Drupal will ask how you want to import the WordPress content. In most situations, it is best to import WordPress blog posts as type Article and WordPress pages as type Basic page.

Wordpress to Drupal 17: Import content

The next import step covers the WordPress blog posts. When you have chosen all of your desired settings, scroll down and click Next.

Wordpress to Drupal 18: Import blog posts

Step 6 involves how to handle WordPress pages. When you have chosen all of your desired settings, scroll down and click Next.

Wordpress to Drupal 19: Import pages

Step 7 is a review, and allows you to make sure that you have chosen all of the import settings correctly for your site. When you are certain that everything is correct, click Save import settings and run import.

Wordpress to Drupal 20: Finish import

The import process may take a while, depending on your connection and the size of the import file. Be sure not to close the window while the process is running.