Search form

Importing WordPress blogs into Drupal

At Acquia's Migration practice, we import all kinds of content into Drupal. In the course of some recent projects involving imports from WordPress blogs we have put the finishing touches on the WordPress Migrate module, and released it to the community. Built on the framework provided by the Migrate module, it provides a simple way to import WordPress blog posts and pages, as well as associated taxonomy, authors, and files, into a Drupal 7 site. A simple form lets you upload a WordPress export (WXR) file (or even import it directly from the WordPress site), make a few configuration settings, and kick off the import - most modestly-sized blogs will complete in a few minutes. Because it’s built on the Migrate module, you can easily rollback and retry your import with different settings.

Obtaining the WXR export

The input to the WordPress Migrate file is a WordPress WXR file, generated by the Export Tool in the WordPress administrative interface:

You can export this file yourself, then upload it into WordPress Migrate:

Alternatively, you may provide your blog address and credentials, and WordPress Migrate will login to your blog and perform the export itself (the credentials are used immediately on form submission and are not saved anywhere):

Import settings

Once you’ve selected your data source, there are several options you can set to control the import (note that if you have imported before, the form will default to the values from the previous import).

Normally, WordPress blogs contain two types of content - “page” and “post”. The first two selections here, Convert WordPress pages/posts to, allow you to select which Drupal content types you want these items imported as.

Next, if you have any file fields on the Drupal content type you selected for posts, you have the opportunity to populate those fields with attachments from WordPress. This is not required - if you do not select an attachment field, the attached files are still imported, and any images are properly referenced from the post body, but this helps to maintain the relationship between posts and files. If you used the Blubrry PowerPress plugin to manage podcasts in WordPress, you can similarly have them assigned to a file field on your posts.

Following that, you can select what text format will be used for the content bodies in Drupal. If you find after importing that the formatting doesn’t look right, it may mean that the format you chose here does not permit all the HTML tags that were present in the original WordPress post. You can also select a different text format for comment bodies.

WordPress supports two types of taxonomy on posts - tags and categories. You can map those to whatever Drupal vocabularies you like, or ignore them.

You can easily make sure that user bookmarks and search engines don’t lose track of your content when you move it to Drupal. One option is simply to use the same paths in Drupal as you did in WordPress - under Path alias handling, choose Set path aliases to their original WordPress value. On the other hand, if you would like to refactor your paths under Drupal, you can use Pathauto in conjunction with Redirect. Set your alias handling to Have pathauto generate new aliases, and check Generate redirects (important: at this writing migration support has not been committed to Redirect, you need to install a patch for this to work). You will get new Drupal paths according to the patterns you set, and anyone attempting to access your posts through the old paths will get redirected with a 301 (Moved Permanently) HTTP code - i.e., search engines will update their database to reflect the new path.

Running the import

Once you’ve made your choices, simply click Import WordPress blog - the import will run in your browser, bringing you to the Imported blogs tab.

Reviewing and rolling back

Here you will find a list of WordPress blogs you have imported (yes, you can bring in more than one!). Basic stats on how many tags, posts, etc. are provided. You also have the opportunity to back out your import and try it again - just click the Update button with Remove imported content selected. Everything you imported will be deleted - you can then change your import settings and try again.

Once you’re satisfied that your blog is successfully imported, you can remove the tracking overhead from your Drupal database while preserving your imported content by selecting Remove migration bookkeeping and clicking Update.

Comments

One additional note, if your WordPress install has multiple user
accounts creating content and you create accounts with the same
username in your Drupal site before the migration, that information
will be retained in the migration.

Note that once you've done the migration and if you do a
rollback, the Drupal accounts will still exist, so you don't have
to create them again.

For free you can import any WordPress blog to a Drupal 7 site at
DrupalGardens.com now that this module is part of Drupal Gardens -
just create a site, enable the module and them import your content.
Then if you want to host it yourself you can even export your site
from Drupal Gardens.

I'm using the Yoast SEO plugin on my WordPress site - which
means I have SEO friendly page titles (the equivalent to http://drupal.org/project/
page_title) as well as meta descriptions and meta keywords. Is
there anyway that these can be preserved during an import/migrate to
Drupal as well?

I had a complex site on wp, but i decided to move content to
drupal. tobe honest i didn't master that plugin way of migration.
So I found online converter cms2cms. I'm so satisfied with the
migration results. This tool moved almost all the site entities with
the internal links and media files I had worried about most. I really
recommend this tool. Here's you may try free demo migration http://www.cms2cms.
com/supported-cms/drupal

Thanks MR - this is truly awesome. Just wondering, whether there is
a way we can ingest WP blogs into Drupal's search results page.
We may have to broaden this topic, however, just want to hear any
idea.

Plain text

Filtered HTML

Use [acphone_sales], [acphone_sales_text], [acphone_support],
[acphone_international], [acphone_devcloud], [acphone_extra1] and
[acphone_extra2] as placeholders for Acquia phone numbers. Add class
"acquia-phones-link" to wrapper element to make number a link.

To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.