The WordPress revisions stores a record of each saved draft or published update. Whenever you save a page or post in WordPress it creates a revision. Revisions can be helpful in case you need to revert back to a previous version of your content. WordPress is written smart enough to ignore revisions while rendering the front end and its MySQL queries are written well enough so revisions don’t actually slow them down. However, post revisions take space in your WordPress database. Revisions are practically full copies of your posts, so if you have hundreds of posts this means you have few hundreds revisions stored too.
There is only ever a maximum of one autosave per user for any given post. New autosaves overwrite old autosaves. This means that no, your tables do not grow by one row every 60 seconds. In multi-user settings, one autosave is stored for each user.
Autosaves are enabled for all posts and pages but do not overwrite published content. Autosaves are stored as a special type of revision; they do not overwrite the actual post. In fact, whether your power goes out, your browser crashes, or you lose your internet connection, when you go back to edit that post, WP will toss up a warning telling you that it has a backup of your post and a link to restore the backup.
All methods used in the wp-config.php will be done, This file is located in the root folder of WordPress on your host. add the following configuration line to it above the “/* That’s all, stop editing! Happy blogging. */“.
Method 1: Limit the number of WordPress posts revisions.
Limit the number of posts revisions that WordPress stores in the database.
By default posts revisions are enabled.
Alternately, the limit can be set in wp-config.php:
define( 'WP_POST_REVISIONS', 3 );
With this code, number of revision limited to 3 last revisions. Old revisions are automatically deleted.
Method 2: Disable WordPress Post Revisions.
This following code will disable all future revisions to be saved.
define('WP_POST_REVISIONS', false );
The above code, will not delete your past revisions that are already saved in your database. To delete all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query.
DELETE FROM wp_posts WHERE post_type = "revision";
wp_posts One of the WordPress tables, “wp_” are Table_prefix in wp-config.php, that can be different.
- true (default), -1: store every revision
- false, 0: do not store any revisions (except the one autosave per post)
- (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.
Method 3: Manage and Control post revisions with Plugins.
If you want to control WordPress revisions in a simple way, You can use the following plugins: