This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
WordPress Disable Post Revisions & Delete All Revisions from Database
Oct 2, 2017Web DevelopmentComments (1)
Post revisions can take up quite a bit of space in your database. If you don't need them, here's how you can easily disable them and also remove any that currently exist in your database. This does require that you have access to PHPMyAdmin (or SSH) and your database login.

Disable Revisions
You'll need to edit your wp-config.php file, which resides in your root WordPress directory. Open it up in a text editor, and add this line anywhere you'd like, as long as it's above the require_once statement at the end of the file:

* Disable post revisions
define('WP_POST_REVISIONS', false);

Now WordPress will no longer save revisions for posts and pages. The /* */ comments aren't strictly necessary, but are good for keeping with the WordPress style of coding.

Delete Revisions from Database
To delete all post and page revisions from the database, run this MySQL query:

DELETE FROM `wp_posts` WHERE `post_type` = "revision" AND `post_name` LIKE "%revision%"
About Autosaves
Doing the above will have no effect on autosaves, which will still be created and preserved. If you'd like to also disable and delete autosaves, read this post on disabling and deleting autosaves.
Comments (1)
Add a Comment
Alexander   Jan 19, 2018
I have use this code exactly same from the tutorial i have seen but still having some issues as it's not working properly or might be i am doing something wrong. Can anyone help me to disable the post revisions ? define('AUTOSAVE_INTERVAL', 300); define('WP_POST_REVISIONS', false); define('WP_DEBUG", false);