admin管理员组文章数量:1323716
I know I can use define('WP_POST_REVISIONS', 5);
to limit future post revisions to 5, but how would I go about purging all existing revisions except the latest 5?
I know I can use define('WP_POST_REVISIONS', 5);
to limit future post revisions to 5, but how would I go about purging all existing revisions except the latest 5?
3 Answers
Reset to default 1Please take database backup and run a below MYSQL query and check is this helpful:
DELETE FROM wp_posts WHERE post_type = "revision" AND ID NOT IN(SELECT ID FROM wp_posts WHERE post_type = 'revision' ORDER BY ID DESC LIMIT 5)
To limit the number of revision saved in the future, you can use
define('WP_POST_REVISIONS', 5 );
Every time you'll save a post, a maximum number of 5
revisions will be kept in the database and all the older ones will be removed.
This will, however, remove them only when saving the posts, so you may want to manually use @Yash solution the first time if you really have a huge dataset.
I just found this plugin that lets you specify how many revisions you wish to keep:
https://wordpress/plugins/rvg-optimize-database/
本文标签: How can I purge all post revisions except the latest 5
版权声明:本文标题:How can I purge all post revisions except the latest 5? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742125247a2421909.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论