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.

For more information, please refer to the drupal.org documentation for WordPress Migrate.

Comments

Posted on by Eric (not verified).

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.

Eric

Posted on by Ryan Szrama.

Great news and great work. : )

Posted on by AndyB (not verified).

Can't even express how great this is! It opens the doors to Drupal for all the Wordpress bloggers looking for more flexibility they can get with Drupal.

Posted on by Michael Rabb Hanover (not verified).

Thanks for the valuable information, Wordpress lovers will surely like this. Drupal will be known by every blog users. Keep the Great Work!!

Posted on by Joel Steidl (not verified).

We used this module at Aten Design Group a couple months ago and it was great! I blogged about our experience using it and recorded a quick screencast. Maybe it will be helpful for someone. Thanks for the module! http://atendesigngroup.com/blog/painlessly-migrate-wordpress-drup al

Posted on by drupaltutorial.co.uk (not verified).

I have to migrate a word press to drupal site for a client so this article has been a great help.. Thanks :)

Posted on by Chris Brookins.

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.

Posted on by Christian M. Grube (not verified).

Small Question,

I've no option available on the tab taxonomy.
Is there anything to know about this small showstopper?

Posted on by mryan.

The next version of WordPress Migrate won't have this issue (the UI is being completely reworked) - you can find work-arounds for the current version at http://drupal.org/node/1565042.

Posted on by Jeremy (not verified).

I had to add 2 empty taxonomy dropdowns to the blog content type one for tags and the other for categories for it to show up in the options for them to migrate

Posted on by Anthony Bouch (not verified).

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?

Posted on by mryan.

Assuming this plugin exposes its data in the exported WXR file, wordpress_migrate can be extended to handle this data. See http ://drupal.org/node/1593478#extending_wordpress_migrate.

Posted on by Alberto Mota.

Thanks guys, really good job. We would love to feature this on a guest post at our website at www.aglobalway.com on Drupal web development. Let me know.

Posted on by markcp (not verified).

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

King Regards!

Posted on by Saravanan Sampath.

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.

Posted on by Jeremy (not verified).

When I migrate WP to my drupal blog I lose the original author information. Its replaced with name of the person who imported it. Any Ideas?

Posted on by Dave Myburgh.

Make sure you imported your users first, then use that user import migrate map when you import your content.

Posted on by flickmedia (not verified).

nice post!!! thanks

Posted on by James (not verified).

Any reason upon import from XML file that server would pull a Internal Server error 500? My error log on server just shows the 500 error and no reason.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

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.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <h4> <h5> <h2> <img>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.