Plugin: Import New Blogger To WordPress

Update #3 (26 April 2007): This plugin has been broken by changes made to feeds on Blogger, and is pretty much unusable anymore. The download links are still there so if you want to try it anyway you can do so. Try to see the method described in TechCounter (the last one) for a good method. Theoretically this would work but I have not tried it. Good luck!.

Update #2: Only 500 posts can be imported via RSS (Blogger limited the RSS feed to only contain 500 max posts). Check out comment 181 and 191 below for suggestions.

Update: This plugin is now known as Blogger RSS Import instead of New Blogger Import.

Back in December, I created a stand alone script to import Blogger Beta to WordPress. I didn’t really expect that many will benefit from it until I received so many comments and bug reports. So here is the improved version, as a plugin. Many improvements were done especially at the database side where WordPress functions are utilized, and there’s no security issue anymore.

Installation

As with any other plugin, here are the steps needed to install this plugin:

  1. Upload the script to /wp-content/plugins folder.
  2. Activate it under Plugins
  3. Look for it under the Manage menu. You should see Blogger RSS Import

Options

  1. Blogger ID: the front part of your Blogger blog. For example, if it’s http://myblog.blogspot.com then you need to enter myblog in the text box.
  2. Default author: if your blog only have one author (i.e. you) and you have created a user before using this script, you can select the user here. All of your posts will be associated to this user.
  3. Match authors…: this is useful if you have not explicitly created your username, or for multi user blogs. With this checked, the plugin will associate the authors with their own post. Any author not found in the system will be created as a subscriber (you need to edit the user later). This option overrides option 2.
  4. Default category: this option generally is the same as option 2 where a single category will be linked to your post. I leave this here for historical purpose and you might never know user’s preferences.
  5. Match categories…: import labels from your Blogger posts. If you don’t have any labels for your posts, it is safe to leave this unchecked and all posts will be associated with the value selected in option 4.
  6. Number of posts per cycle: This is the number of posts that will be imported per cycle, if you choose to have staged import. I recommend this for most users.
  7. I want to import everything all at once: this is the default behavior of the script when it was first released, until some users are having trouble with big number of posts to be imported from their Blogger. This disables the staged import and overrides option 6.
  8. Haloscan friendly: this option will cause your posts to have comment fields (invisible) for this Haloscan importer to work.
  9. Do not import comments: speeds up your import if you have no comment or 100% of your comments come from Haloscan, for example.
  10. Maintain my permalink: Blogger has a different way of setting post permalinks, and luckily it’s included in the feeds. Even if this is imported, you will need to edit your permalik structure to /%year%/%monthnum%/%postname%.html to work. Stephen might want to share his tips on this as he uses it.

Requirements

  1. Either allow_url_fopen is set to On, or the CURL extension is installed on the server.
  2. Full feeds are enabled on your Blogger (see image below)
  3. An open mind πŸ˜‰

Blogger Feed Settings

Will not work if…

  1. Your site is not hosted on Blogger server (i.e. on your own domain). You’ll need to republish everything on Blogger.
  2. You use other feed than Blogger feed (i.e. FeedBurner)

Tested on…

  1. WordPress 2.0.5
  2. WordPress 2.0.7
  3. WordPress 2.1

Credits goes to…

  1. My wife for being here for me
  2. Charles Wesley for suggesting CURL
  3. Dawn for the staged import
  4. John Halton for asking for the Haloscan import
  5. Stephen Newton for asking for Permalinks
  6. Ricardo for providing a testblog, and testing lots of things
  7. Andrea Trasatti for trying to help with the author & category matching
  8. Sander van Dragt for WordPress MU compatibility
  9. John Bindel for reporting and noticing the spot for the comments dates bug

And many thanks for the donators. Although I can’t withdraw money from Paypal, at least I can pay certain services. I appreciate your support.

Download

I know you are getting bored reading to all of text up there, so here it is:

new-blogger-import-1.0-final.zip (md5sum: 30538edd35c9427363e37dc842e78e07)
new-blogger-import-1.0-bugfix-1.zip (md5sum: 62ec6348b314df8ddd0d8df057e01812)
blogger-rss-import-1.1.zip (md5sum: 5e5b938a288eeb6cc1eb0e4f83edbd7a)
blogger-rss-import-1.2.zip (md5sum: ce31c1b8abf779c6758f026c2fd3bbfe)
blogger-rss-import-1.2.1.zip (md5sum: a4f6912601f25bee3c5ba31d9cd89769)

This is for users having trouble with the zip file: blogger-rss-import.txt (save as .php and upload it)

For those who would like to see the code: blogger-rss-import.phps

Please report all bugs to ady at romantika dot name.

Problems Encountered By Users

  1. Error 502

Warning: fopen(http://xxxxxxx.blogspot.com/feeds/xxxxxxxxx/comments/default) [ function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 502 Bad Gateway in /home/xxxxxxxxxxx/public_html/wp-content/plugins/new-blogger-import.php on line 143

This problem is usually caused by connection between the host (server) and Blogger being not stable. There’s nothing I can do about it, but you can try again. Many users succeed when trying again.

Extra

During testing, for your convenience do consider WordPress Suicide. You can use it now, compared to before as reported by David in this post. Don’t delete all tables, use these settings:

WordPress Suicide

Update: Justin has announced an upgraded version to cater to WordPress 2.1. This is needed as a new table was introduced to WordPress 2.1

Images

Images are not imported to your WordPress blog, so if your images are hosted on Blogger, they will not be displayed to visitors because of the hotlink protection. Consider this plugin by Notion: Blogger Image Import.

Problems?

If you encounter any problems, you are welcome to email me or post a comment. Please take note however that I will need time to respond, and look at the problems. This code is in no way 100% free from bugs.

I recommend all questions include everything you know, up to the extent of the PHP version on the server, if you know. In any case please included these information as a minimum:

  • Blogger URL
  • Destination WP URL

It would be extra helpful to have a screenshot of the error message, or any particular area you are having problems with. Here’s a good software to capture screenshots called MwSnap.

In short, I need as much information as possible in order to give advice and help you troubleshoot the problem. I am no clairvoyant πŸ™‚

Post changelog

  • February 1, 2007 19:25 GMT+8
    • Changed /%year%/%month%/%name%.html to /%year%/%monthnum%/%postname%.html (Thanks Stephen)
  • February 23, 2007
    • Added problems section
    • Urgent Bugfix – permalinks with dash or underscore not captured. Any other characters used in blogger Id?
  • February 26, 2007
    • Upgraded to version 1.1 and changed name to Blogger RSS Import. I think the new name is more suitable, without the word “new” that confuses many people.
    • A very important update to this version is the ability to extract more than 25 comments, where this problem was faced by John Doe (refer to comments). A revamp was done to the code to extract comments.
    • Also added was the ability not to import comments, and skip cycles to minimize overlapping posts when re-importing.
  • March 4, 2007
    • Version 1.2 is released. Important bug fix – comments dates were incorrectly imported (only effects version 1.1). Thanks to John Bindel for reporting and noticing the problem in the code.
  • March 5, 2007
    • Version 1.2.1 is released due to some problems getting initial comments data (number of comments). I am sensing that Blogger is making changes. This plugin may be obsolete soon so if you want to use it, do it now.
  • March 8, 2007
    • I don’t know what I was thinking, with the phps version. Obviously it would not work as the web server will format the output to be pretty. I’ve provided a link to the text version.

Complete code changelog is available inside the plugin file itself.

If you find this plugin useful, feel free to


0 Shares

258 thoughts on “Plugin: Import New Blogger To WordPress”

  1. The import went very smoothly but the whole permalink structure is missing: dates, categories, everything. The blog homepage is fine but clicking on other links yields nothing and I see the files are not on my site.

    Do I have to select a nondefault permalink format using Word Press before I import my Blogger files?

  2. RD,
    That’s correct. You need to enter the following as a the permalink structure:
    /%year%/%monthnum%/%postname%.html
    Of course, now that you’ve already imported everything not using that permalink structure, you’ll need to now use the suicide to clear out your blog (or do it manually) πŸ™

    Good Luck,
    JD

  3. Thanks. Before posing this query, I deleted all the content manually, used the Word Press permalink options menu to choose what I think is the equivalent of your suggestion, and then reimported my Blogger blog content(which is very small, BTW.) Still no dice with the categories, or in fact, with any other files other than the homepage.

    I also cannot add categories to NEW postings, nor do any archives get created, though the home page looks fine.

    A note on my Blogger permalinks. The permalinks are structured by blog entry title, not prefaced by year and month. Is this what is screwing things up?

    And would it also affect the ability to add new posts properly to the file structure?

  4. I wish I knew how to edit my comments so that I wouldn’t have to clutter up this page.

    Correction: My Blogger posts are in year-month-title format.

    Via domainname.org/bloglocation/wp-admin/options-permalink.php, there is an option to customize permalinks. I chose option 2–date & name based. This should work, right?

    Should I use Suicide and just try again from scratch? Previously, I manually deleted all the posts.

  5. Fantastic. Me ha pasado todos mis post de blogger (biharenea.blogspot.com alojados en blog.biharenea.eu (dominio propio)) sin ningun tipo de problema y a la primera. Gracias. Antes de esto me estaba volviendo loco para poder hacer el cambio.

  6. @RD: No actually it does not matter whether you import before or after you change anything in your blog options (options – > permalink). What the maintain permalink option do is make sure that %postname% contains the same one as in blogger. That’s all, since blogger uses a different algorithm than WP does to determine this name.

    For example, if I were to host this page in blogger it might become https://blog.adyromantika.com/2007/01/31/import-blogger-wordpress/ or https://blog.adyromantika.com/2007/01/import-blogger-wordpress.html
    and if I import to WordPress without the maintain permalink option it becomes the current URL you see on top. That’s the only purpose of the import option.

    This is particularly useful only for people who publish via FTP and have their own domain. For example if your blogger is http://somename.blogspot.com/2007/01/mypost-here.html and you import to a WordPress installed on a domain it’ll become http://www.somename.com/2007/01/mypost-here.html it’ll become less useful as your permalink is not maintained (unless you redirect from blogger). Please note you still have to manually maintain this in the (option – > permalink) as /%year%/%monthnum%/%postname%.html for it to work. Initial install does not have the permalink structure set up, and is in the form http://www.somename.com/?p=1 (for first post as an example).

    You can edit WordPress permalink option (option – > permalink) before or after. It does not matter. The plugin does not change this setting in WordPress. It just maintains %postname% to be the same as in blogger.

    One pitfall I see sometimes is that users don’t have write permission to the / directory, so WordPress can’t write into .htaccess to activate the permalink structure. Do make sure that .htaccess have been created/updated for the new permalinks to work.

    I hope my explanation is good to understand. πŸ™‚

  7. I’m still confused on what I am supposed to do. I already changed the permalink option in my Word Press installation by checking the second option, i.e. year-month-posttitle. Adn when I imported my content from Blogger, I checked the maintain permalink option. But still I get no working permalinks on my Earthlink site, though indeed the permalink names were conserved.

    Now do I have to manually add something to the .htaccess file? If so, what exactly? Please spell it out because I do not understand what you are saying. And is there anything more I have to do to activate/maintain permalinks, or is this all?

  8. I goofed by getting the permalink format wrong. I neglected to notice that a custom format is required as indicated by others here. Menu option 2 adds the DATE between the month and the posttitle. So I made the customized correction to the permalink options, suicided the blog to be on the safe side, and re-imported it. BUT STILL NO FUNCTIOING PERMALINKS.

  9. I don’t think this guy understands the concept of permalinks. Dude, empty your blog, and then don’t tamper with the permalink options in WordPress. Import. See what happens. Anything comes out on your blog?

  10. True. You can worry about the permalinks later, after you are sure the posts have been imported correctly. Just check the “maintain permalinks” option while importing.

    I think RD feels that I am at fault here with his permalink problem so I am going to repeat again: this plugin only saves the %postname% part from blogger, and it is up to users to configure it in WordPress πŸ™

  11. This will be my last comment. Actually, I do understand the procedure, and followed it properly. The result was an impecabble main blog page, on which noe of the links work. But I se the rest is my problem, to be addressed via help on the WordPress site, esp. since Earthlink itself is unhelpful. If you’ll permit one last question, since you brought this up earlier:

    One pitfall I see sometimes is that users don’t have write permission to the / directory, so WordPress can’t write into .htaccess to activate the permalink structure. Do make sure that .htaccess have been created/updated for the new permalinks to work.”

    I know I there is a .htaccess file, but I have no idea whether it has been properly “updated”, whatever that means, for the new permalinks to work. If you are so inclined, could you tell me what I have to do to check this out?

    In sum, the fault is elsewhere; your import plugin seems to work smoothly and perfectly. I misunderstood, thinking that the plugin itself creates the permalink structure on the WordPress blog, but obviously it does not, and that’s not your responsibility.

  12. @RD: OK, in WordPress permalinks option, at the bottom of the page (before the logo), do you see this:

    htaccess permalink

    If not, and you have configured your permalinks, then most likely it has already been saved. Another way is to download .htaccess to your machine and examine it. (The box will only be displayed if WordPress failed to write to .htaccess – like mine, I set it that way).

    BTW what’s Earthlink?

  13. I compared the file you gave to my htaccess file. The only differences are:

    (1) The code you give is nested in between these two lines of code:

    # BEGIN WordPress

    # END WordPress

    (2) The only other difference is that this piece of necessary code is included . . . preceding the BEGIN statement:

    AddHandler php5-script .php

    Earthlink is an ISP which also provides web hosting. They are well known but I don’t see their ads on TV anymore. I don’t think they’re doing a great job at catching up to the state of the art. And they have not been informative so far. It’s possible that Earthlink is screwing me up and not Word Press. But I haven’t figured out the Permalinks problem yet. Thanks for your efforts.

  14. Yes, .htaccess has different effects on different hosting companies. Post your old & new URL here, or if you want you can email me so that I can have a look at suggest on the next steps, if any.

  15. Fantastic! Thank you, I was holding off switching to WP until I could find a suitable import for new style blogger blogs. Installed this plugin and was all done in about 5 minutes :O)

    Top Drawer!!!

  16. Thanks for this fantastic script; however I have a problem with my permalinks – I wonder if you can offer any advice. I have WordPress (2.1) set up to use /%year%/%monthnum%/%postname%.htm but the Permalink URL that is generated by the import is in the form http://www.domainname.co.uk/blog/year/month/httpbloggeridblogspotcomyearmonthpostnamehtm.htm. Please can someone offer some advice as the new Blogger is driving me insane and I’m desperate to move to WordPress but need to maintain my URL structure (for Google’s sake!)

  17. @Neill: Great!

    @Mark: That’s weird. If you still haven’t figured it out, do consider sending me the link to your new WP blog so that I can have a general look and give suggestions if I can. In the import page, the plugin displays the captured %postname% from blogger. Do you see http[bloggerid]blogspotcom[year][month][postname]htm (if you do, we have a problem – please ignore the square brackets, just put there for clarity) ? Also I will need the bloggerId so that I can run tests to see what happened. As usual if you’re not comfortable in posting it here, email me directly.

    *A screenshot would be really helpful, if possible.

  18. @Ady,
    Thanks for getting back to me so quickly. My original blog is at http://www.markwilson.co.uk/blog/ but that’s published via FTP so, to meet the script’s requirements I moved the blog to http://mark-wilson.blogspot.com/ and am trying to migrate it to a new WordPress installation at http://www.youknowone.co.uk/blog/

    Once this is working, I can redirect my original domain name to the new site and all the old links will still work, but running on WordPress!

  19. @Mark: I found the problem. Your Blogger Id contained a dash character which is not recognized by the plugin when looking for the %postname%. No need to change anything on your side – since this is quite an urgent bug and a very petit bug, I’ve updated the plugin to Bugfix 1 and it now recognizes the dash and underscore characters. Please try it out. Thanks for reporting this and for the complete info given! πŸ™‚

    And… I am sorry it messed up your import. Looks like you have to re-import.

  20. @Ady – thanks for writing that fix (and for doing it so quickly). It worked a treat – 711 posts migrated to the test site with just a few clicks. Tomorrow I’ll start the migration for real and soon I’ll be free of Blogger πŸ™‚

Comments are closed.