H3XED

WordPress Disable Post Revisions & Delete All Revisions from Database

Oct 2, 2017   Web Development   Nick Vogt   Comments
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
Facebook Twitter

Comments (0)

Share This Post
Facebook Twitter
H3XED © Nick Vogt   RSS   Policies   Facebook   Twitter   Google+