June 24, 2015

How to Import your WordPress Blogs to Drupal

It is a well known fact that you can upload and import all sorts of content onto your Drupal. Recently, we’ve been handed many requests regarding WordPress blog imports, so we decided to introduce you to the WordPress Migrate module. The WordPress Migrate module is built around the framework offered by Migrate module and provides simple steps to importing pages and blog posts from WordPress along with the associated taxonomy, files, and authors to your Drupal 7 site. With a simple form, you can upload WordPress export files (WXR) or import them directly, add a few changes in the configuration settings, and make them live! It takes a couple of minutes for the average blog to import, and you can also retry and rollback imports using different configuration settings.


The WXR Export

The WordPress WXR file is the input in the WordPress Migrate module that is generated through the Export Tool available in WordPress Administrator interface. Simply click on tools and under the ‘Choose what to export’ section, click on all content. You will be taken to the WordPress migration bar where you can export these files on your local computer and then upload them on WordPress migrate. As an alternative, you can provide the blog address and credentials to WordPress migrate where it will export the files itself.

Import Settings

After selecting the data source, you have various options to control imports. Generally speaking, WordPress blogs have two content forms – ‘pages’ and ‘posts’. The first two options in Import Settings, namely ‘Convert WordPress page/post to’ allow you to choose the Drupal content that you want the items to be imported as. This is followed by file fields on the Drupal content type you choose for posts. You can easily populate the fields using attachments from WordPress. While not necessary, this does help you in maintaining the post and file referencing. Once you’ve finished choosing the imports, choose the text formats you want to use on the content bodies for Drupal. If you don’t think the formatting is right after making imports, it may indicate that the chosen format does not allow all HTML tags that were imported from the original post. You can also choose different formats for comment bodies. To make sure that your user bookmarks and search engine results are not affected by the content shift, you can use the same paths that you did for WordPress in Drupal. For instance, under the Path alias handling option, select ‘Set path aliases to their original WordPress value’. Alternatively, you can re-factor the paths in Drupal using the Pathauto and Redirect tools. Once you have set the alias handling to ‘Have pathauto generate new aliases’, click on ‘Generate redirects’. This way, your Drupal paths will be in accordance to the patterns you set and search engines will update their database accordingly.

Running the import

Click on ‘Import WordPress blog’ after selecting your content paths and you will land on the ‘Imported blogs’ tab. Here, you can remove your imports and try them again by clicking on the Update button and selecting the ‘Remove imported content’.