0

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.

1

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 S 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. – markratledge 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... – Shimon S Jul 11 '12 at 20:22
  • No, you don't; read the docs for the plugin. – markratledge Jul 11 '12 at 21:10
0

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
    This doesn’t affect existing revisions. – fuxia 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. – Shimon S Jul 11 '12 at 20:32
  • How can we limit revisions on a wordpress.*com* blog? – Santosh Kumar Sep 8 '17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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