How to: Control how much post revisions are saved

Post revisions is a cool feature, but you probably know that it increase the size of your WordPress database. If you want to limit how many post revisions can be saved by WordPress, or even disabling this functionality, just read on.

To achieve this recipe, you have to edit your wp-config.php file. The wp-config.php file is WordPress configuration file, where you defined your database parameters when you installed WordPress. It is located on the root of your WordPress install.
To limit post revisions, just add the following lines:

define ('WP_POST_REVISIONS', 5); //Defines a maximum of 5 different revisions per post.
define('AUTOSAVE_INTERVAL', 3600); // Auto-saves on 1 hour interval

In this exemple, I have defined a maximum of 5 posts revisions. IF you don't want WP to save any revision, just type 0 instead of 5.

9 Responses

Oct 30 2008 16:48

How does 600 work out to auto-saving every hour? I think you better check your math.

Oct 30 2008 17:00

@Jason Trometter: It was a type, not a math error, but thanks for letting me know.

Oct 31 2008 00:49

thanks for this tip Jean.
i was bothering with autosaves,
added codes,hope it works:)
cheers~

Oct 31 2008 05:43

Aha that’s simple, making good result! Thanks

Nov 02 2008 02:24

Long time reader first time poster etc.

Thanks for this tip. I often dip directly into the db for my own geeky reasons and it does get hard to see the wood for the trees with all the revisions that I never need.

Nov 02 2008 04:37

Thanks much for your tips!

Nov 05 2008 14:55

Cool tweak.
I’ve got a very limited hosting and don’t want my SQL DB to blow up.

Mar 18 2009 05:21

Thank you SO MUCH for this tip, what a big help it is!!!!!!!!!!!!!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required
Blog And Make Cash