【转载】删除并禁用历史修订功能

此为转载文章,原链接:http://www.aips.me/disable-and-delete-wordpress-revision-history-of-a-method.html

1.禁用 WordPress 文章修订历史功能

打开 WordPress 根目录下的 wp-config.php 文件,添加下面的代码即可:

1
define("WP_POST_REVISIONS", false);

2.删除 WordPress 已有的文章修订记录

上面也说过,WordPress 文章的修订记录,都是被写入了数据库,所以我们需要删除MySQL数据库中有关的语句SQL 如下(直接删除即可):

1
2
3
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';

OK,搞定了,操作完上面的两部,以后在wordpress写文,将不会产生历史修订,所以数据库也不会变的庞大!