emlog5.1.2 转 WordPress3.6
没用工具,直接操作数据库。

wp_ 是新装的 WordPress3.6
emlog_是老的数据库

清空 wp 数据

  1. delete from wp_postmeta
  2. delete from wp_posts
  3. delete from wp_terms
  4. delete from wp_term_relationships
  5. delete from wp_term_taxonomy

复制代码

插入分类

  1. insert into wp_terms(name,slug,term_group) SELECT sortname,sid,0 FROM emlog_sort

复制代码

插入分类映射

  1. insert into wp_term_taxonomy(term_id,taxonomy,description,parent,count)(select term_id,'category','',0,1 from wp_terms)

复制代码

插入新的字段

  1. alter table `wp_posts` Add column sortid  int null default 0 AFTER `comment_count`

复制代码

插入文章

  1. 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)
  2. 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'

复制代码

插入文章,分类映射

  1. 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

  1. update wp_posts set guid='http://www.domain.com/?page_id='+id

复制代码

删除字段

  1. alter table `wp_posts`  drop column sortid

复制代码

over 。看演示。