禁用并删除wordpress修订记录

1.禁用 WordPress 文章修订历史功能
打开 WordPress 根目录下的 wp-config.php 文件,添加如下行即可:
define(‘WP_POST_REVISIONS’, false);

2.删除 WordPress 已有的文章修订记录
WordPress 文章的修订记录,都被写入了数据库,既然我们不使用他们,可以通过以下 SQL 语句可以删除:

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’;

Leave a comment

You must be logged in to post a comment.