How to Migrate a WordPress Blog to Tumblr

You probably all remember (and mourn) Dateline: Silver Age, the blog that I and some cohorts ran for a couple of years, chronicling oddball newspaper headlines in old comics.

It’s been “on hiatus” for a couple years now, just sitting there doing nothing except being yet another WordPress install I have to update and maintain to keep people from screwing with. So I was thinking, you know, this thing is well-suited to Tumblr, so why don’t I move it there, and then I can get rid of the WordPress install and make it someone else’s problem!

Turns out, such a migration isn’t as easy as it seems, and the information for doing so is scattered hither and yon, so I’ve decided to give a working (at least for me) method for moving a WordPress blog to Tumblr.

1) Naturally, create your Tumblr account first.

2) Go to the control panel of your WordPress blog and select “Tools > Export”. I then selected “Posts” and then hit “Download Export File”.

3) Check the export file! It will be an XML file with a bunch of goop in it, but what you mainly want to check is that every <item> has a <content:encoded> section with actual content in it. For some reason, the first time I did the export, this was not the case. When I did the export again, it looked correct.

4) Tumblr has a limit on how many posts can be imported per day. It’s somewhere around 75. 70 is safe. You will want to divide your XML file into separate files so that there’s no more than 70 <item>s in each file. Each file should contain 70 <item>s, with the same stuff before and after the list of <item>s in each one.

5) Now you’ll need this PHP script. In case it disappears, you can also find it here.

6) Edit the script with your information:

line 11: $xmlFile = 'MYEXPORTFILE.xml';

should include the name of the XML file you want to import.

line 14: $tumblr_email = 'EMAIL';
line 15: $tumblr_password = 'PASSWORD';

should contain the email address you used to log into the Tumblr blog and the password.

line 18: $tumblrUrl = 'http://MYTUMBLRID.tumblr.com';

should contain the URL of your Tumblr blog.

7) Upload the tumblr_import.php and the XML file to a web location where you can access it. Then run the php script by going to it in your web browser like so:

http://www.mysite.com/tumblr_import.php

(where www.mysite.com is the place you put the php file.) This should import all the items in the XML file to your Tumblr blog.

8) If you have more than 70 items to import, wait a day and then upload the next XML file, change line 11 in tumblr_import.php to that filename, and run it again.

IMPORTANT CAVEATS:

* The site I am converting was very simple stuff. Each post contained an image with alt/title text, a caption, and occasionally a line or two of text. No idea how this method works with more complex content.

* The posts were originally made using WordPress’ editor, and it does some things that normal HTML and XML doesn’t really know what to do with (regarding captions on images). So I had to do some fiddling with the XML content to pretty things up.

* Tumblr did not import the images, merely pointed to them for displaying. I’ll continue having to host the images myself, which is fine for my purposes.

So now there is datelinesilverage.tumblr.com! I’m still working with the template and importing posts, so imagine a parade of animated “UNDER CONSTRUCTION” images. And yes, there is alt-text!

The original site is still there and will continue to be there for a while. As to whether or not this means the return of Dateline: Silver Age, we haven’t gotten that far yet. I’ll keep you posted.

Many, many thanks to Miguel Santirso, who wrote the tumblr_import.php code.

This entry was posted in Site and tagged , , . Bookmark the permalink.

Comments are closed.