H3XED

WordPress Disable Post Revisions & Delete All Revisions from Database

Please note that this post is over a year old and may contain outdated information.
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.
Share This Post
Twitter

Comments (1)

Alexander   Jan 19, 2018
I have use this code exactly same from the tutorial i have seen https://www.wpblog.com/disable-limit-wordpress-post-revisions/ 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);
Share This Post
Twitter
H3XED © Nick Vogt   RSS   Policies   Twitter