解决wordpress导入mt时的tags和slug问题

MT(4.2rc)导出的TXT文件里其实是有包含tag和slug数据的, 分别标记为TAGS和BASENAME, 只可惜目前wordpress还不支持,小小patch一下

--- wordpress/wp-admin/import/mt.php    2008-04-15 01:26:07.000000000 +0900+++ gopherwood.info/wp-admin/import/mt.php  2008-07-01 10:05:56.000000000 +0900@@ -359,6 +359,16 @@                $category = trim( substr($line, strlen("PRIMARY CATEGORY:")) );
if ( '' != $category )
$post->categories[] = $category;+ } else if ( 0 === strpos($line, "TAGS:") ) {+ $tags = trim ( substr($line, strlen("TAGS:")) );+ if ( '' != $tags ) {+ $post->post_keywords .= $tags;+ }+ } else if ( 0 === strpos($line, "BASENAME:") ) {+ $slug = trim ( substr($line, strlen("BASENAME:")) );+ if ( '' != $slug ) {+ $post->post_name = $slug;+ } } else if ( 0 === strpos($line, "DATE:") ) {
$date = trim( substr($line, strlen("DATE:")) );
$date = strtotime($date);
« 時間よ止まれ AZU feat. SEAMO VPS Village »

3 Responses to 解决wordpress导入mt时的tags和slug问题

gravatar Brando at July 8, 2008 3:47am

前段时间看你用Habari,后来又看到你用MT,咋到后面就用Wp了,你还真会“玩”

gravatar wayne at July 8, 2008 4:07am

@Brando: 咳咳,换去MT是那时候对静态发布特有好感,换回来是因为实在受不了MT的评论速度,提交评论会连带一串的页面重建,太累。。。

gravatar Brando at July 8, 2008 5:46am

原来如此。

Name (*)

Email Address (*)

Web Address

Other  Receive Email Notify

Comment