删除wordpress文章修订版本

by Web全栈工程师 on 2013 年 10 月 22 日

WordPress每次修改文章,都会保存一份修订版本,有时候我们需要清理下修改版本,否则一篇文章编辑几十次,数据库冗余太多。

数据库手工删除

删除post_type为revision的文章,及其文章的id编号关联着文章的wp_postmeta和wp_comments以及wp_term_relationships

DELETE FROM wp_postmeta WHERE post_id IN (SELECT id FROM wp_posts WHERE post_type = "revision"); 
DELETE FROM wp_term_relationships WHERE object_id IN (SELECT id FROM wp_posts WHERE post_type="revision");
DELETE FROM wp_posts WHERE post_type = "revision";

插件删除

比如:delete-revision

设置修订版数量

修改wp-config.php,只保留最近三份修订版本

define('WP_POST_REVISIONS', 3);

Comments on this entry are closed.

Previous post:

Next post: