Hefta-Gaub Development Blog

May 26, 2007

Improved WordPress to WordPress Importer

I’ve been playing around with importing WordPress blogs from one instance to another, and I’ve been frustrated by some of the default features of the built in WordPress to WordPress importer.

So, I’ve implemented a new version of the importer that has the following features:

  • Attachments – This importer will download and “insert” the actual image files of an attachment record. So for example, if you’ve uploaded images to your WordPress blog, then they will be listed as attachments. The normal importer will store these records but no do anything with the actual image. So you basically end up with dead links. Not anymore. Now if the image is an attachment, the importer will attempt to download it and insert it into the new blog. All of this downloading happens on your server, so you don’t actually have the files download to your client machine.
  • Links – Links to your own blog are remapped. This is particularly important for image links to attachments (obviously) or else the attachment feature described above would be pretty whacked! But it also applies to cross links between your own blog posts. Seems like an obvious feature right? I thought so. This also applies to internal ping backs.
  • Spam Comments – For some reason the default importer decides to import comments tagged as spam. I guess I can imagine a few cases where this might make sense… but nah… I don’t think so. So this importer will discard any comments marked as spam.

Installation: Download the code from the link below. Rename the file to zappo_wordpress.php and place it in your wp-admin/import directory.

Download: You can get a copy of the code here.

Usage: Same as any other importer, go to Manage->Import. Enjoy.

By the way, I really only tested this on WordPressMu, but there isn’t anything about it that I would expect to fail on standalone WordPress. Feel free to report bugs if you see issues.

Hey Zappo – This thing is really chatty, what gives? Do you think you could make it not print out so much noise? - You

No. But you can. Enjoy! - Me

About these ads

22 Comments »

  1. When I import from my old WordPress blog, NONE of my authors map correctly, the author of any post from the import is me. Also, none of the category information is importing either.

    I’ve taken a look at the code, and I have a few ideas about what might be causing this, but I thought I’d ask you if you’ve seen this problem before, and what I need to do to fix it.

    Thanks!

    David Buttrick

    Comment by David Buttrick — May 27, 2007 @ 6:24 pm

  2. David,

    Please send me your XML and I’ll test with it.

    Thanks!

    Comment by zappoman — June 4, 2007 @ 5:27 am

  3. Zappoman,

    When I run your script inside WPMU 1.2.1 I get the same error that I get when I run the standard WP->WP import script. I’ve got an exported XML file from a standalone instance of WP 2.1.3, and when I try to import it into WPMU i get the following error:

    Warning: Invalid argument supplied for foreach() in C:\www\webroot\wordpressmu\wp-admin\import\zappo_wordpress.php on line 441

    This shows up both in your script and in wordpress.php (diff’t line numbers).

    I don’t think the problem is with your code, but maybe you’ve seen int before or know what the source is? There are many of us seeing this problem (http://mu.wordpress.org/forums/topic.php?id=3299&replies=18#post-30076)

    Comment by gentry underwood — June 9, 2007 @ 4:51 pm

  4. Gentry,

    I’ve seen this problem too, it’s related to the array passed to a foreach() loop being empty.

    I am pretty sure this warning is benign, but annoying… it’s also related to PHP being more strict in the recent versions.

    Were you able to import even though this happened?

    Would you be willing to send me your XML so I can test with it?

    Comment by zappoman — June 9, 2007 @ 6:30 pm

  5. Hey – thanks for writing. The error would appear benign in the case that both the exported an imported blogs had one author, but otherwise it isn’t. basically it’s crapping out on recognizing the author of each of the exported posts, even though just before import the script was able to recognize that there were multiple authors being imported and asked which new authors to map them to… after the import (and the error messages), the author of every post is the main admin…

    i can send you the xml — drop me an email at this address and i’ll reply with it. i’m going to upgrade the export blog to 2.2 tomorrow and see if that changes anything.

    Comment by gentry underwood — June 11, 2007 @ 5:37 am

  6. [...] comes the Improved WordPress to WordPress Importer developed by zappoman. This importer will download all the attachments off of the old server and [...]

    Pingback by Tech-Cookies » Running backups of wordpress.com blogs — June 16, 2007 @ 8:22 pm

  7. By the way Gentry… I noticed that there is a fix posted for the original wordpress to wordpress importer for multi-author blogs. I will look at incorporating those fixes into my plugin soon.

    Comment by zappoman — June 17, 2007 @ 4:03 am

  8. You’re my hero Zappo, thanks a lot for your work on this, it’ll surely become helpful to me soon!

    Comment by Leftblank — June 24, 2007 @ 4:29 pm

  9. zappoman, you are great!!!
    Your importer works infinite times better than the WP default one!!!

    Comment by Hernán — July 1, 2007 @ 4:08 pm

  10. [...] To WordPress Import: In Improved WordPress to WordPress Importer, Hefta-Gaub Development Blog tackles the issues many WordPress users face when they move from one [...]

    Pingback by WordPress Wednesday News: WordCamp Filling Up Fast, WordPress 2.2.1 Mandatory Upgrade, Hot WordPress Themes and Plugins, WordPress Security, and WordPress Nerds Blog Naked : The Blog Herald — July 5, 2007 @ 12:34 am

  11. Hmmm… I guess I should release my latest version. :)

    I’ve also cleaned up the blogger importer to handle the same issue of link remapping and image download. I should probably release that too.

    Comment by zappoman — July 5, 2007 @ 3:47 am

  12. [...] own full version of WordPress. For more information on moving your blog, see Importing Content, Improved WordPress to WordPress Importer, and Can I move my blog from here to another blog somewhere else … from the WordPress.com [...]

    Pingback by WordPress Wednesday News: WordCamp, Sponsored Themes Out, 2 Billion Comment Spam, and More WordPress News : The Blog Herald — July 12, 2007 @ 6:21 am

  13. Hello Zappo! Do you still actively develop this plugin? I tries to use in under the current WPMU 1.2.4 , but there are som problems. First there is a missing include, to use register_importer (from admin-functions.php). I needs some other functions too, I added includes, but it still says “Cannot load importer.” when I try to use it. Thanks…

    Comment by Andrisi — August 29, 2007 @ 8:09 am

  14. I haven’t tested it under the latest build… I will take a look at it when I get a chance and post an update. Feel free to take a crack at it if you need it soon. ;)

    Comment by zappoman — August 29, 2007 @ 9:04 am

  15. Hi
    is this compatible with the current version of wordpress 2.6.0 i have tried it a couple of time now and i keep getting an error “cant load importer”
    Any ideas why?

    Comment by Kathryn — July 24, 2008 @ 7:24 pm

  16. I need a wordpress to wordpress importer. Do you still offer this one? I see no link for the download. Thanks.

    Comment by Larry — August 9, 2008 @ 9:01 am

  17. Found your post very helpful and has shed some light into the things I’ve been trying to do. Thanks for posting.

    Comment by Van Marciano Art — December 5, 2009 @ 6:25 pm

  18. No Files!

    Comment by CS — August 17, 2010 @ 12:37 pm

  19. great publish, very informative. I’m wondering why the opposite specialists of this sector don’t understand this. You should continue your writing. I’m confident, you’ve a huge readers’ base already!

    Comment by spells to get my ex back — August 22, 2011 @ 5:17 pm

  20. I :love: this! This whole operation is amazing! This is a big :) in my books!

    Comment by Brittany Valenstein — September 3, 2011 @ 4:28 am

  21. When I initially commented I seem to have clicked the -Notify
    me when new comments are added- checkbox and from now on each time a comment is added I recieve 4 emails with
    the exact same comment. Is there a means you can remove me from that service?
    Thank you!

    Comment by Hayden — August 22, 2012 @ 8:21 pm

  22. I actually consider this specific blog post , “Improved WordPress to WordPress Importer | Hefta-Gaub
    Development Blog”, pretty pleasurable and the post was a remarkable read.
    Thanks for the post-Kristopher

    Comment by Sven — January 25, 2014 @ 1:52 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: