Remove and Prevent Revisions in WordPress

I recently noticed that a particular post had built up about 10 or 15 revisions for it. I started thinking that of all the posts I have, there have to be quite a few revisions and therefore are creating a hefty sized table in my database. This was run on my WP 2.8, but should work for 2.6 and up.

Here is a solution to prevent revisions from being created, as well as removing all revisions from your database.

Prevent Revision Creation

Open wp-config.php and add this to the very bottom of the file, before the php closing tag.

define('WP_POST_REVISIONS', false);

This completely turns off any revision creation. If you’d like to restrict revision creation to a set amount per post, you can change ‘false’ for the number of revisions you’d like stored.

Remove All Revisions From Database

Open up your database in phpmyadmin and run this SQL Query.

DELETE FROM wp_posts WHERE post_type = "revision";

And now you’ll have a more tidy database.

0 Comments
Submit Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

To include your code, use pastebin, and paste the URL in the comment body. Failure to do so may prevent your comment from appearing. Thank you.