H3XED

WordPress Disable Autosaves & Delete All Autosaves from Database

Oct 2, 2017   Web Development   Nick Vogt   Comments
If you don't want WordPress creating autosaves of your posts and pages, 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 Autosaves
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 autosaves
 */
define('AUTOSAVE_INTERVAL', 86400);

This doesn't technically disable them, but rather pushes the interval out by a full 24 hours. The /* */ comments aren't strictly necessary, but are good for keeping with the WordPress style of coding.

Delete Autosaves from Database
To delete all autosaves from the database, run this MySQL query:

DELETE FROM `wp_posts` WHERE `post_type` = "revision" AND `post_name` LIKE "%autosave%"
Post Revisions vs Autosaves
Autosaves are a type of revision that are generated automatically by WordPress. Only one is created per post or page, unlike post revisions which can create multiple revisions for each post or page. Doing the above will only affect autosaves and leave the post revisions untouched. If you'd also like to disable and delete post revisions, please read this post on disabling and deleting post revisions.
Share This Post
Facebook Twitter

Comments (0)

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