Limit the number of posts revisions that WordPress stores in the database.
edit wp-config.php
file in WordPress root:
1 |
define( 'WP_POST_REVISIONS', 3 ); |
WP_POST_REVISIONS:
- 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.
Example:-
Step 1:-
First we will need to open up your wp-config.php
file. This is located in the root of your WordPress site.
Step 2:-
Insert the following code in wp-config.php
file.
1 2 3 4 5 |
//disable WP Post Revisions // Change auto save interval define('AUTOSAVE_INTERVAL', 300); // seconds // Disable WP Post Revisions define('WP_POST_REVISIONS', false); |
or
1 2 |
// Limit WP Post to 3 define('WP_POST_REVISIONS', 3); |
Note: This needs to be inserted above the ‘ABSPATH’ otherwise it won’t work.