在升級 WordPress 2.3 以後,發表文章時可能會噴「wp_post2cat does not exist」錯誤訊息。

主因是 2.3 升級程式會將 wp_post2cat 以及 wp_categories 兩個資料表刪除,而下列外掛或佈景會需要用到此兩個資料表:

  • Google Sitemaps Generator older than 3.0
  • Posts by Author plugin
  • Ultimate Tag Warrior
  • K2 Theme

詳見:Solution for 2.3 database errors / wp_post2cat does not exist

臨時解決方案 – 將這兩個 table 重建回來

wp_post2cat

CREATE TABLE wp_post2cat(rel_id bigint(20) NOT NULL AUTO_INCREMENT, post_id bigint(20) NOT NULL default 0, category_id bigint(20) NOT NULL default 0, PRIMARY KEY (rel_id), KEY post_id(post_id, category_id)) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

wp_categories

CREATE TABLE wp_categories(cat_ID bigint(20) NOT NULL AUTO_INCREMENT, cat_name varchar(55) NOT NULL default "", category_nicename varchar(200) NOT NULL default "", category_description longtext NOT NULL, category_parent bigint(20) NOT NULL default 0, category_count bigint(20) NOT NULL default 0, link_count bigint(20) NOT NULL default 0, posts_private tinyint(1) NOT NULL default 0, links_private tinyint(1) NOT NULL default 0, PRIMARY KEY (cat_ID), KEY category_nicename(category_nicename )) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;