This script (MtTaggedExport.php) creates a Moveable Type blog export file with tags added to the keywords field.The default MT export contains keywords and categories, but not tags. WP imports keywords as tags, so we’re going to put the MT tags into the keywords area. Everything else in the tagged export file should be exactly the same as the default export file (see notes for exceptions).
This script is for people who have been given an exported MT database but do not have admin access to the actual MT site. (If you have access to your MT installation, it is probably much easier to create custom export template [or “index template”] and do a little grep after. See this foliovision.com article and template example.)
To use this script, you need:
- your MT database information
- permission to move this script file to a place that can connect to your MT database
- Download MtTaggedExport.php.
- Open the file in a text editor & edit the database login information.
- Place the file someplace that can connect to your MT database.
- Open the page in your browser. Then copy and paste the text in your browser window as a .txt file. (Or, I hear there’s this thing called Terminal that will do the whole thing with a single command.)
- Import your new file into WordPress (from the dashboard menu > Tools > Import).
- I wasn’t sure what the entry_status codes were. I guessed that 3 = “Review” and 4 = “Future”
- The tagged export file imported fine when I tried it on my local computer and on my personal site. When I tried importing it on the client dev server, there were an error in the permalink slugs. Any blog post title that contained a period, “.”, had a broken permalink slug that also contained periods. To fix, just delete the period (and any extra dashes) in the permalink. I don’t know why this happened, please comment if you do.
There may be some differences between the MT default export file and the file produced by this script:
- Sort order of categories may be different, depending on how case sensitivity is set up on your database server.
- Line breaks are created using nl2br(), sometimes it doesn’t quite match up with the MoveableType export. Extra line space is forced with <p> instead of <br /> in the comments.