Reindexing old MT entries

I’m not quite there yet, but I’ve got all my old MT articles with the same IDs as they had under that CMS. I basically used DrBacchus’ More about migrating from MT to WP method, but tried to integrate Scott Hanson’s Export from WordPress. It was not a complete success, but I’ll document what I did here in the hope that it’s useful.

DrBacchus was using an older version of MT, while I’m using the most recent version. I found that the file you have to edit to insert IDs is lib/MT/ImportExport.pm — not lib/MT/App/CMS.pm.

If you can avoid the temptation of adding blog entries to WP before importing from MT, do so. It’s a royal pain to add them later.

I used the WP MT-export module to export all my blog entries, then trimmed out the existing entries which had been entered in MT. I then added entry IDs to the export file (an awk one-liner: awk 'BEGIN{id=323;} {print;} /^STATUS: / {print "ID:", id; id++;}' worked for me, as my highest MT article ID was 322). I then joined the export files from MT and WP in one big ‘export.txt’ file.

If you have existing WP entries, you’ll have to get rid of them. I found that going directly into the database, and doing:

delete from wp_posts;
delete from wp_comments;

would do it.

Don’t forget to patch import-mt.php as per DrB’s instructions before importing.

Here’s where the pain comes in — WP wouldn’t import the text from the entries created in MT. It restored all the metadata, but not the content. So I had to manually patch in the entries from the export file.

I still have to work out rewrite rules for permalinks, but at least everything’s on the server where it should be. Maybe John’s Moved To WordPress rewrite rules will help me, as I think that my host (1and1) may not be doing entirely halal things with .htaccess support.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *