Converting Blogspot / Blogger to hosted WordPress
Posted on April 16, 2012
First Try
Migrating your Blogspot or Blogger weblog to a hosted WordPress installation should be easy. But you may run into some problems along the way, so here are some quick ways to make it less painful.
When I first attempted this, I used the Blogger Importer plugin found in the “Tools” → “Import” menu of a new WordPress installation. It went OK. The importer pulled in all of the posts and the comments, but there seemed to be some extra markup that made it’s way into the posts. All of the post titles now started with “>”:
>Why Hello There!
Also, while images in the content seemed to be fine, none of the media was actually imported into WordPress, they were still being hosted on blogspot.com.
Resetting the WordPress installation to start over
So now WordPress has a bunch of content that I want to delete so that I can start over and hopefully get it right the next time. For this I used WordPress Reset. I was able to use it to remove the (bad) imported content and reset it back to a new installation. It’s multi-site friendly and only restored the one site and left all the content from the parent and sibling sites alone – although I can’t vouch for what it would do if you ran it on the parent site of a network installation.
A 2-Step Approach
Now that I was back to square one it was time for a different approach. After some reasearch, someone on the WordPress Forums mentioned using WordPress.com to do the Blogger import, then exporting from WordPress.com as a native WordPress export file (WXR / XML), and import that file into your new WordPress installation.
Importing Blogspot / Blogger to WordPress.com
So over at WordPress.com, everything is like a normal WordPress installation, except they have turned it up to 11. They have powerful servers, and a dedicated staff that make amazing additions to the most popular free plugins – one of which is the Blogger import. On WordPress.com you have an additional option to import a Blogger export file:
Rather than authorizing the plugin to get everything from the site, we’ll export it to a file. Log into your Blogger account. When you’re logged in and viewing your blog there’s a “Design” link in the upper right menu bar, click that. Once you’re at the Blogger administration page click the “Settings” menu, and then “Other.” You will have an option under “Blog Tools” to “Export blog”:
Take that file and import it into a new WordPress.com site. You’ll want to make sure that this blog is public (but not necessarily indexed by search engines) as our hosted WordPress installation will need to be able to pull media files from it, but we don’t want it to wind up on Google, as it’s only temporary. It might take a while to fully complete, but WordPress.com should bring in all your Posts, Comments, and Media just fine. Once you’re sure that it’s done, export the WordPress.com site through the “Tools” → “Export” menu, selecting “All Content.”
Importing WordPress.com’s export into a hosted WordPress site
Before we begin importing the content from WordPress.com, two things should be changed in the WordPress Importer plugin‘s wordpress-importer.php file, which can be done through the plugin editor.
Just so we know when the importer runs into issues, change IMPORT_DEBUG to true:
/** Display verbose errors */
define( 'IMPORT_DEBUG', true );
Then to make sure we get everything, find the line that starts with:
$post_exists = post_exists( $post['post_title'], ...
This was on line 539 for me. Comment it out using slashes:
//$post_exists = post_exists( $post['post_title'], ...
Then just below that line add:
$post_exists = false;
I did this because when WordPress.com imported images from Blogger, it gave them the same name as the post title, So if a post was called “Why Hello There!” and it had 5 pictures in it, all 5 pictures also had the title “Why Hello There!” This was preventing the importer from getting everything. Plus I already reset the installation, so there’s no content to duplicate or overwrite anyway. And I reasonably trust that I want to retrieve everything contained in the WordPress.com export file.
Run your import and everything should go smoothly. After you’ve verified you have everything in your new hosted WordPress installation, you can delete your WordPress.com site or make it private. You may also want to undo the WordPress Importer changes for future imports.