We are already aware that WordPress auto saves the post at regular intervals. This feature is known as post revision. Different post revisions can be accessed by clicking on time stamp of the revision. There are plus points and also minus points of post revisions.
Plus point is that since WordPress automatically saves your post at regular intervals, it can prevent loss of your draft which can happen in case of internet disconnection or when your browser gets hanged (or gets closed by mistake). Minus point of this feature is that it occupies space in database, which means waste of space and slow loading of database. If you take more time to write a post, then you can see a good amount of post revisions (10 or more) that are saved automatically.
There are three options for you. You can either change auto save frequency, disable it entirely so that no post revisions are saved or just change the auto save interval. Let’s take a look at all the options.
Limit Auto Save Post Revisions
You can limit number of autosave (post revisions). Let’s say you want WordPress to limit post revision to 3. To do this, you need to edit wp-config.php file (which is a core and very important file). This file can be found from the root of your WordPress installation. Before proceeding further, we would recommend you to backup this file so that if anything goes wrong, you can simply restore this file.
Open wp-config.php and add below code at the end of this file:
You can replace 3 with the number of your choice. With this code, only last 3 latest post revisions will be saved.
Disable Post Revisions
If you don’t want to limit/change auto save frequency, then you can also entirely disable post revision in WordPress. To do this, open wp-config.php and the add the below line:
With this code, no more auto-save of the post will be performed. This means that if by chance while writing a post, your browser stops working or internet disconnects, then you don’t have any way to recover that post.
Change Autosave Interval
You can also change auto save interval of the post. Let’s say you want to auto save the post every 3 minutes (which means 180 seconds). To do this, you need to add below code to your wp-config.php file.
define( ‘AUTOSAVE_INTERVAL’, 180);
Note that you need to add time in seconds and not minutes. Your post will now be auto saved at every 180 seconds.
If you want to prevent trash from piling up, then you can use any one of the above methods as per your need so that only required post revisions are saved. It really doesn’t makes sense to have 10-15 post revisions waiting for you, which cannot be deleted.