• Technosailor.com
  • Desk of the Editor
  • Venture Files
  • Tech Policy
  • Contenido EspaƱol
Technosailor
  • Authors
  • Disclosures
Jul
05
2006

WordPress-to-WordPress Import

Posted by: Aaron Brazell
Woodlawn, MD, USA

I know there are quite a lot of folks who have wanted to merge WordPress blogs or in one way or another import from one blog into another. The feature is coming in the next major build of WordPress and is already in place on WordPress.com blog. Trust me. But for now, I have wrapped that code into a plugin. I’ve already merged two blogs and there are other reasons I need this as well. It works. I have not had a lot of other extensive testing, but for me it works.

So while Matt Mullenweg wrote most of this code, I’ve ripped it off and made it into a plugin for those of us not running bleeding-edge next-gen WordPress blogs.

The exporter pumps a WordPress blog (including comments) out to a WXR file (WordPress eXtended RSS). It will allow you to import blog entries and comments into an existing WordPress blog. It does not overwrite existing entries and it respects authors by giving you the ability to choose who the imported entries are attributed to.

To use it, download the zip (7.6k) or tarball (6.8k) and extract.

  1. Upload wp-xmlmigrate.php to wp-content/plugins/
  2. Upload wordpress.php to wp-admin/import/
  3. Activate the plugin.

Note: Both of these files are optional. Uploading wp-xmlmigrate.php and activating will only provide the ability to Export a WordPress blog via the Manage > WP Export menu. Uploading wordpress.php will allow you to import an existing WXR file (a dump from another blog). This file is actually an importer, not a plugin, and so activation is not required to use it. Access the Import mechanism through the standard WordPress Import menu.

Really, the credit goes to Matt Mullenweg for 90% of the code.

Changelog
1.0
- Initial Release
1.0.1
- Minor PHP fixes
1.0.2
- Fixes Version check error when migrating from a WP 1.5.x blog
2.0 - Nov 15, 2006
- Rewrite of codebase
- Fixes “dirty” XML export
- Add support for Category Exports
- Adds support in Export for “Excerpts”. Does not fix weakness in wordpress Importer that does not import excerpts.
2.0.1 - Dec 5, 2006
- No Fixes to export
- Now bundled with new Automattic-developed wordpress.php import file

Table of contents for WordPress Plugins

  1. WordPress-to-WordPress Import
  2. WordPress-to-WordPress Import v2.0 Released
  3. New Version of Serendipity (s9y) to WordPress Importer Available
  4. Timecapsule Plugin 1.0.3
  5. WordPress Plugin: Embargo Press Release
Next in series
  • Add to Mixx!
  • Stumble it!
About the Author: Aaron Brazell is the lead editor of Technosailor.com and a social media expert. His passion is to see companies and individuals use the internet and web technologies wisely and effectively to promote their brands and companies. He is Business Development Manager for Lijit and he worked as Director of Technology at b5media from 2005-2008 and is currently an independent consultant.
Tagged: WordPress Plugins Series at 7:14 pm -
discussion by DISQUS

Add New Comment

  • Subscribe:  This Thread
  • Go to:  My Comments ·  Community Page
  • Sort thread by:

    Viewing 276 Comments

    Thanks. Your comment is awaiting approval by a moderator.

    Do you already have an account? Log in and claim this comment.

      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      patrick 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Schweeeeet. I'm wanting to do some merging, too. This is perfect. It's like there's a force of attraction at work here.
      reply  edit  flag   record video comment
      http://www.southwestern.edu/~ramseyp /people/4a62fef61f1926012125614918b32ff3/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Hope it works out well for you, patrick.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      felipe.lavin 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Great idea! I would like to ask you something before trying it out: what happens with blogs that use format plugins on posts like Textile, Markdown, etc.? The export gets the "source" of the post (that is, using the plugin's format) or the processed code (XHTML output)?

      Great work!
      reply  edit  flag   record video comment
      http://www.yukei.net /people/bc7cc3fdb4af85e7923367e5f234f77b/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Felipe--
      Textile and MArkdown are both plugins. Therefore they are filters of the_post(). If you look in the database at the raw entry, it will have all the textile/markdown markup. It's not formatted there. When the_content() is called and filtered on Markdown or Textile, the formatting comes through.

      That being the case, if you import a WordPress blog that has been using Textile/Markdown, you'll be pulling in the raw content that is unformatted. To preserve the formatting, the new blog will have to have Textile or Markdown enabled as well.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      A.M.G 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Just leaving a note of gratitude. I've been putting off this sort of thing for lack of knowledge and a burning desire to surf for it. The plugin made it a snap. Much appreciate Sir.

      And I couldn't help but notice The Wire: Season 1 peeking at me from below. Great, great show. First class all around in my opinion. McNulty man.
      reply  edit  flag   record video comment
      http://griffinopolis.com /people/e0e311e7cf9e398c8375891e0e8330b4/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      skeddy 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Just wanted to say a big thank you for this plugin, it's been a great help in setting up a test site for me, so I can play about with themes before they go live!

      Even for just a few posts to test, this plugin in invaluble!
      reply  edit  flag   record video comment
      http://skeddy.net /people/658a7546d8ab93ec60b5f6fc53af3924/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Steven Vu 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Hi,

      I've just tried to import my old wordpress blog into wordpress.com . Sadly it says

      Sorry, there has been an error.

      The uploaded file exceeds the upload_max_filesize directive in php.ini.

      The file is about 2.1mb. Is there any way I can chop the file?

      regards,
      Steven
      reply  edit  flag   record video comment
      /people/f11d84cb1d0128a8c2615dae8aff5cac/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Steven Vu 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      I've just used the plugin to import roughly 180 posts, 320 comments, 30 categories and 8 authors. Wordpress was just becoming a bit of a hassle - wordpress.com is so much easier. You can concentrate on writing for a change.

      Worked without a hitch and all is great with the world again.
      reply  edit  flag   record video comment
      http://stevenvu.wordpress.com/ /people/f11d84cb1d0128a8c2615dae8aff5cac/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Valerie 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Good Morning, Aaron.

      The plugin is giving me an error when I activate it in my wp1.5.1.3 version blog:

      Warning: Wrong parameter count for substr() in /home/grace/public_html/wp/wp-content/plugins/wp-xmlmigrate.php on line 12

      Consequently, I am not given an option to export.

      I am on the verge of closing my old blog (leaving a host) and your plugin promises to preserve just files I care to keep.

      I would appreciate any help you could offer. I am using your plugin version 1.0.

      Thank you for the right plugin at the right time!

      Update: I decided to try to remove line 12 along with it's corresponding brackets . . . and It Worked! :)

      I thought this would still be worth posting.

      Now, I suppose I also wouldn't mind being able to easily export my links. Just in case. :mrgreen: (How come wp doesn't allow for subcategories for links, anyway?)
      reply  edit  flag   record video comment
      /people/85b76e82176ff991cc991ee3bc82cba8/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Thanks, Valerie. A bug makes it incompatible with 1.5. Recommend you upgrade to 2.0 before attempting. I'll fix the bug later.

      As for the rest of the import, unfortunately this is not a full fledge importer. This is a plugin that duplicates behavior in the next version of WP. I suppose I might be able to figure out how to do the links and cats, etc, but everything would get a little complex for an XML file. We'll see.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Hello Aaron,

      Great Plugin! But the import dont work at my blog. I import the xml file an after a while I get the message to download my admin.php! Whats wrong? Hope you can help me!

      killercup
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      killercup: It sounds to me like a plugin. I'd recommend disabling your plugins and re-enabling them one by one until you find the culprit. Let me know which plugin you find is causing this. Thanks
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      thank you for your quick answer. i disabled all plugins and got the same message. download admin.php. but why download?! the admin.php is executable and works fine. is there some other chance to fix this?
      please help me! i have to migrate a blog with more than 500 osts an sql-import crashes because i got an error when i want to write a new post.
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Well, just to be clear, I don't do free support. Most of this code is taken directly from WP 2.1. What version of WP are you running?
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      2.0.3
      is it clever just upgrade to the newest beta?
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      2.0.4 is in beta and should be okay. I don't recommend upgrading to 2.1 yet unless you plan to write patches and do testing.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      thank you for your help. do i have to subscribe to the teser-mailing-list or is there any other possibility to get the current 2.0.4 beta? i dont have svn.
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      hey, i know whats wrong! when i try to import a small file everything is ok. but when i try to import an 1,6 mb file with over 1500 entries I get the error.
      if this is an server-problem, please tell me, else it might help to split large files on export!
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Aaron 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      killercup: That's largely up to the server configuration of PHP. Not really a WP issue.
      reply  edit  flag   record video comment
      http://www.technosailor.com /people/d409f7e3d0b43dd41dcfbd58aa255601/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      killercup 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      I ve asked my hoster, they have configured only the php limit at 8MB.
      i hope you can tell this some other developers and there will be an option to split the export e.g. in month.
      reply  edit  flag   record video comment
      http://killercup.de.vu /people/70ededa34e1d921262ae51d566f59243/
      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Phil 2 years ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      The plugin is broken on 1.5.x. Line 12 has bad substr args. Try this instead:

      if ( ( '2.0' == substr( get_bloginfo('version'), 0, 3 ) ) || ( '1.5' == substr( get_bloginfo('version'), 0, 3 ) ) )
      reply  edit  flag   record video comment
      http://www.philhord.com /people/2b7f7a97f72215b00a83081e0376b6cb/