I some posts I have a lot of revisions, and I want only 2 revisions for each post.
I found this plugin http://wordpress.org/extend/plugins/revision-control/ that able to set that in the future WP will not store more then 2 revisions, but It does not remove existing revisions.
I found this plugin http://wordpress.org/extend/plugins/better-delete-revision/ that can remove all the revisions. But I can not set to leave 2 revisions.
2 Answers
You can use define ('WP_POST_REVISIONS', 2);
in wp-config.php for two revisions, and you could turn that into your own plugin.
Manully remove all revisions with this query run in phpmyadmin:
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'
and then optimize.
-
I think that
define ('WP_POST_REVISIONS', 2);
will not remove existing revisions. Right? And the query will remove all revisions - I dont want to remove all revisions but I want to leave 2 revisions for each post– Shimon SJul 9, 2012 at 18:33 -
wordpress.org/extend/plugins/revision-control/screenshots will leave the number of revisions you want and delete the rest. Jul 9, 2012 at 19:15
-
By this way I have to take care about every post, one by one. I have more then 8,000 posts...– Shimon SJul 11, 2012 at 20:22
-
Add define( 'WP_POST_REVISIONS', 2 );
to your wp-config.php
.
This'll limit to at most 2 revisions (you can also completely disable them with false
).
-
1
-
It will, the instant OP updates a post/page. Still, can use a plugin or SQL to wipe all existing. Jul 9, 2012 at 18:29
-
It does not remove existing revisions. And I did not find any way to remove all revisions and to leave 2 revisions for each post.– Shimon SJul 11, 2012 at 20:32
-