Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
    
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 –  s976 Jul 9 '12 at 18:33
    
wordpress.org/extend/plugins/revision-control/screenshots will leave the number of revisions you want and delete the rest. –  songdogtech Jul 9 '12 at 19:15
    
By this way I have to take care about every post, one by one. I have more then 8,000 posts... –  s976 Jul 11 '12 at 20:22
    
No, you don't; read the docs for the plugin. –  songdogtech Jul 11 '12 at 21:10
    
Thank you for your help –  s976 Jul 12 '12 at 17:21
add comment

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).

share|improve this answer
1  
This doesn’t affect existing revisions. –  toscho Jul 9 '12 at 18:22
    
It will, the instant OP updates a post/page. Still, can use a plugin or SQL to wipe all existing. –  TheDeadMedic Jul 9 '12 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. –  s976 Jul 11 '12 at 20:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.