没用工具,直接操作数据库。
wp_ 是新装的 WordPress3.6
emlog_是老的数据库
清空 wp 数据
- delete from wp_postmeta
- delete from wp_posts
- delete from wp_terms
- delete from wp_term_relationships
- delete from wp_term_taxonomy
复制代码
插入分类
- insert into wp_terms(name,slug,term_group) SELECT sortname,sid,0 FROM emlog_sort
复制代码
插入分类映射
- insert into wp_term_taxonomy(term_id,taxonomy,description,parent,count)(select term_id,'category','',0,1 from wp_terms)
复制代码
插入新的字段
- alter table `wp_posts` Add column sortid int null default 0 AFTER `comment_count`
复制代码
插入文章
- insert
into wp_posts
(post_author,post_date,post_date_gmt,post_title,post_content,post_status,comment_status,ping_status,post_password,post_name,to_ping,pinged,post_modified,post_modified_gmt,post_content_filtered,post_parent,guid,menu_order,post_type
,post_mime_type,comment_count,sortid) - select
1,from_unixtime(date),from_unixtime(date),title,content,'publish','open','open','','','','',from_unixtime(date),from_unixtime(date),'',0,'http://www.domain.com',0,'post','',0,sortid
from emlog_blog where type='blog'
复制代码
插入文章,分类映射
- insert
into wp_term_relationships(object_id,term_taxonomy_id,term_order)
select a.id,a.term_id,0 from (select id,sortid,0,wp_terms.term_id,slug
from wp_posts,wp_terms where slug=sortid)a
复制代码
更新 guid
- update wp_posts set guid='http://www.domain.com/?page_id='+id
复制代码
删除字段
- alter table `wp_posts` drop column sortid
复制代码
over 。看演示。