Migrating from Livejournal to WordPress

Now that I’ve moved off of LiveJournal I want to encourage everyone else I know to do the same. To this end, I thought I’d write up how I migrated to WordPress for the benefit of anyone else who might consider it, now or in the future. It was fairly time consuming, but not actually difficult in any way. Most of the time was spent figuring out how to do different things, not actually doing them, so these directions should help speed things up some for anyone else who’s interested in doing this.

Setting up WordPress

The first thing to do is download and install WordPress, either in your web space or, as I do, on a development machine while you get it ready to go up. System requirements are on their site but it’s basically just PHP and MySQL which are pretty ubiquitous.

I’ve found that the easiest way to customize the appearance of WordPress was to use the theme browser to find a theme similar to what I wanted and use that as a starting point. This was much faster than starting from scratch and it got a lot of the tedious stuff out of the way so I could concentrate on my own style. For my site, I wanted to keep my existing look, so I chose Simple Green as a starting point. After installing the theme, I made a copy of it to a new directory, changed the name at the top of style.css, and started customizing. It’s easy to switch back and forth between themes from the WordPress admin interface.

Exporting Livejournal posts

After you’ve got things looking the way you want, it’s time to import your data. There are two steps to this: 1) exporting from Livejournal, and 2) importing into your new MySQL database. Livejournal’s export tool is nearly useless in that they support exporting comments as well as posts, but don’t let you actually do it from here. Additionally, this tool does it one month at a time, which will take you ages to import if you’ve had your LJ for a while (I had mine nearly four years when I did this).

The way around this is to use ljArchive, a desktop application that can export your journal history, including comments, into one big XML file. It seems to do some other stuff as well, but I’ve only used it for this one thing so I can’t comment on the rest of its functionality. The down side to this program is that it only runs on Windows and even then requires that you have the .NET framework installed. I installed it on a Windows machine at work.

Once ljArchive is set up, the first thing you need to do is create an archive (File->New Archive): enter your LJ username and password, and tick the “Download Comments” box, if you want them (should be checked by default). After this all you have to do to is tell it to export your data: Go to File->Export->XML Writer, choose a filename and tell it to export everything into a single file. Below, in the “Export Settings” area, you can choose not to export protected (ie, friends-only) posts. It will export everything by default.

When ljArchive finishes doing its thing, you’ll be left with a big XML file containing your entire Livejournal history, posts and comments. Now you need to get this stuff into your database in a format that WordPress can understand. WordPress comes with scripts to import data from a variety of other systems (Livejournal, Movable Type, Textpattern, etc), but the Livejournal script, written for use with LJ’s export tool, doesn’t expect to see comments and so won’t import them. Luckily, Vinit Bhansali has made available a modified version of this script that will. Download import-livejournal.php from his site, replace the one that ships with WordPress (in your wp-admin directory), and follow the Livejournal import instructions. Your comments will be imported along with your posts. I successfully imported 500+ posts and 700+ comments this way with no trouble, but it still might be a good idea to back up your database first.

Caveats

There are a few things to note about this procedure.

Comment threading will be lost

There’s not much you can do about this but it shouldn’t be a big deal unless you’ve got posts with lots and lots of sub-threads going in the comments. I don’t, so I can’t offer any advice here.

Protected posts are now public

If you told ljArchive to export protected posts, they will now be public on your WordPress site. This is easily avoided by not exporting protected entries.

Comments on imported posts will all be disabled

This is a bit of a problem if you want to still be able to get comments on older posts. With a little poking around I found that the following steps will turn them all back on. SSH to your web host, log in to MySQL, and run the following commands:
mysql> use <database name>;
mysql> UPDATE wp_posts SET comment_status = 'open';
mysql> UPDATE wp_posts SET ping_status = 'open';
</database>

Abracadabra, your comments are all turned back on. The second UPDATE command turns trackbacks/pingbacks back on.

Posts with no subjects break permalinks

If you’re using mod_rewrite for human-readable URLs (highly recommended), and you’re not in the habit of giving your Livejournal posts titles, you will find that none of your permalinks work. Permalinks generally contain the title of the post in the URL, so you get URL paths like /2005/12/08/post-title. If post-title is an empty string, you won’t be able to link directly to it or read attached comments. The only way to fix this is to use the WordPress administration interface to go through your entire post history and add titles. Tedious? You bet! But you’ll be going through all these posts one-by-one anyway (read on), so get used to the idea. If you think you may want to migrate in the future, start using titles now.

All posts are in the category “Uncategorized”

Remember when I said you’d be going through all these old posts anyway? This is why. Livejournal is the only blogging system that has no concept of post categories/topics, so when you import your posts, they all go into the default WordPress category, “Uncategorized”. This is probably not what you want. I found it easiest to assign whatever categories came to mind as I waded through my history, and then refined the list after I was finished. WordPress lets you see how many posts are in any given category so it was easy to go back through and drop the categories that only had a few posts. By the time I finished I had a pretty good idea of what categories I needed.

If you want to tag your posts outside of the standard categories, now is the time to decide, or else you’ll go through this all over again as you add tags (like I did). I’m using the Ultimate Tag Warrior plugin for this.

Empty comments

As I went through my posting history in the above steps, I found a dozen or two weird empty comments. Almost all appeared to be from people on my LJ friends list, but these comments did not exist on the original LJ posts. Strange. Delete them.

Syncing posts

If you want to have WordPress copy posts to your Livejournal, use the Live+Press plugin. It allows you to choose whether to sync on a post-by-post basis and gives you the option of sending only an excerpt rather than the whole post if you prefer.

Update

If you’re using WordPress 2.0 (not yet released at the time I originally wrote this), Live+Press will not work. Use LiveJournal Crossposter instead. Not only does it work With WordPress 2.0, but it works much better than Live+Press.

I’d be interested in hearing how these instructions work out for anyone who uses them. Have fun!

Comments

[...] In an effort to use the domain I’ve paid for and not used for over a year, I’m taking Kenn’s kindly posted advise and trying to use my WordPress blog in conjuction with my LJ account. Visit his informative post on Migrating from Livejournal to WordPress. [...]

Eric says:

Two questions,
1) Does Ultimate Tag Warrior treat tags as categories? In other words, if you set a post’s categories, they will also set as tags, and vice versa?
and 2) Does the live+press plugin trigger when you use an external xlm-rpc posting medium? If I use Ecto or Qumana, instead of the WP dashboard, will the posts still get crosslinked to LJ?

Thanks. =)

Kenn Christ says:

1) Ultimage Tag Warrior will create tags from your categories, but it’s an option that can be toggled on/off (I think the default is to create them). It does not create categories for your tags. This allows you to treat tags as dynamic “subcategories” of sorts. Compare my category and tag pages for an example.

2) This I don’t know. My guess would be that it doesn’t, but I don’t really base that on anything. I haven’t tried it.

[...] Migrating from Livejournal to WordPress Just what the doctor ordered (tags: blogging) [...]

Nisha says:

Thanks for this! Will try it out now.

BB says:

Thank you so much for this! I was having such a hard time getting my posts away from LiveJournal.

Janet Callahan says:

Thanks you for this clear set of instructions and links to various tools.

I’m actually migrating to drupal, but there’s no clean way to get from LJ to drupal, so I’m going LJ to wordpress, and wordpress to drupal.

[...] ? ?????????????, ??????? ????? ?? ?????. ??????? ??????? ?????: SSH to your web host, log in to MySQL, and run the following [...]

James says:

I use the LJ cross-poster to send my WordPress posts to Livejournal. It works really well.

Jetoile says:

With the new version of WP, you can set all your entries to private. I’m finding it easier to work this way. Keeping everything private, then going back and making selected posts public.

UPDATE `wp_posts` SET post_status = 'private';

Jarl says:

Hey,
I’ve been looking for a way to do this for a while.
Thanks much.

-Jarl

dimensha says:

you. are. awesome. this saved me soooo much hassle. i dreaded the thought of having to export each month of my LJ (since ’04) individually. ljarchive saves the day!

[...] I’d suggest to migrate to wordpress. Here’s an older article (from ’05) that is still relevant on how to migrate from LiveJournal to WordPress. You’ll definitely want to not use your name since its so long and is not catchy on its own. [...]

Ejia says:

Thankfully, WP now imports comments as well. THanks for the info about LJArchive’s XML export! It saved me a world of trouble.

Tristan says:

Glad I found this. Downloading my 3000 posts & 10,000 comments now. :-/

Aden says:

Question. I’m not sure if you’d know, but I thought I’d ask still. I’m looking to archive a community from IJ over to LJ. Most resolutions don’t seem as good as this though, so we may just switch our plan to transfer things to WordPress. My question is, is there a way to transfer posts to Livejournal and still retain comments? I’m really doubting it, but it can’t hurt to ask someone who seems like they’d have an idea!

lg says:

great post! i’ll post my results later.
cheers,

lg