Whenever we start a new blog post, wordpress will start taking revision for each post update, so that it may be easy for the blog poster to revert back to the old contents if any thing goes sideways.
Let’s say for eg. a site has 500 pages or posts with 250 revisions on each, this would be over 100,000 entries in the database. This happens a lot more frequently than you might think.
So to avoid this lets minimize the revisions count or if you need you can disable it entirely in your site. For that we just need a single php line to be in wp-config.php
The above code restricts the wordpress to save only 3 revisions maximum.
The above code restricts the wordpress to save any revisions.
Where can i find the wp-config.php ?
To access the file, you should have access to the ftp of your wordpress site. So if you do so, you can go the wordpress installation root directory in which you can find the file.
Open your wp-config.php file and paste the above code as per you need. Again, you can change the number to how many of revisions you want to keep stored in your database per page or post.
You can see the below example:
define('WP_DEBUG', false); /** * Custom Defines */ define('WP_POST_REVISIONS', 3); define('AUTOSAVE_INTERVAL', 86400); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
Note: The code needs to be inserted above the ‘ABSPATH’ otherwise it won’t work.
As the bonus part you can delay the autosave of wordpress by using the below code. This will increase the WP performance if you have busy blog.
define('AUTOSAVE_INTERVAL', 86400); // 1 day