One of the issues that you always discover in any migration is that Wordpress and Movable Type do not maintain the same permalinks. As a owner of a blog, you want to keep your old URLs (permalinks) consistent, since google (and other search engines) and links to your site are all based on the permalinks URLs.
After a number of hours, I figured out some of the ways of retaining the original permalinks from MT and allowing for it to be consistent in Wordpress.
Step 1: Modify WordPress Import mt.php file
In the /wp-admin/import directory, you will see a file called mt.php. Open it up in your favorite editor and go to around line 330. There you will see:
} else if ( 0 === strpos($line, "TITLE:") ) {
$title = trim( substr($line, strlen("TITLE:")) );
if ( '' == $context )
$post->post_title = $title;
else if ( 'ping' == $context )
$ping->title = $title;
Here, you will copy this collection of code and then paste the same content below this collection (essentially offering a duplicate of the TITLE option). Then, you need to change:
- TITLE to be BASENAME
- $post->post_title to be $post->post_name
- $title to be $>postname
It turns out the MovableType gives you the name of the Permalink in the BASENAME variable and you can change the WordPress post name (or post-slug) in this manner. You then get:
} else if ( 0 === strpos($line, "TITLE:") ) {
$title = trim( substr($line, strlen("TITLE:")) );
if ( '' == $context )
$post->post_title = $title;
else if ( 'ping' == $context )
$ping->title = $title;
} else if ( 0 === strpos($line, "BASENAME:") ) {
$postname = trim( substr($line, strlen("BASENAME:")) );
if ( '' == $context )
$post->post_name = $postname;
else if ( 'ping' == $context )
$ping->post_name = $postname;
After you make this change, save the file.
Step 2: Export your MovableType blog
In MT, you can export your data in the MT format by going to the following URL:
http://[YOUR WEBSITE DOMAIN HERE]/mt.cgi?__mode=start_export&blog_id=1
Save the file as a text file (blogname.txt).
Step 3: Import to your WordPress 2.5+
Once you save the file as a text file (blogname.txt), you then go to the Import functionality of your WordPress installation. This is found at:
http://[YOUR TEMP DOMAIN HERE]/wp-admin/import.php
Once you go through the process of Importing the blogname.txt file, you will have the new site updated with the correct URLs/permalinks. All of the slugs are also updated.
Hope this gets included in the next WP installation.
No comments:
Post a Comment