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);
原创文章,转载请注明:转载自Web开发笔记 | 删除wordpress文章修订版本
本文链接地址:https://www.magentonotes.com/clear-wordpress-revisions.html
Comments on this entry are closed.