Post Revisions is a WordPress feature that has proven to be helpful as the revisions system stores a record of each saved draft or published update. While these are very nice to have, some databases can balloon if you're prone to making a lot of changes or spending a lot of time creating a post. To help keep your database size down — which keeps your install speedy — you might want to fine tune the amount of revisions your site saves.
Running a MySQL query
If you don't want to add another plugin into your WordPress installation, then you can run a simple SQL query to remove revisions.
To set up a SQL query:
- Open your panel and navigate to the MySQL Databases page.
- Log into phpMyAdmin. You will see your tables listed on the left.
- Click your database name.
- Make a note of the table prefix.
The table prefix may appear as "wp_" but it’s very possible to have a random string of letters such as "wp_qch9en_".
- At the bottom of phpMyAdmin, click the 'Console' icon to open the SQL command window.
- The SQL command page opens:
- Paste the following SQL command in the SQL window:
DELETE FROM wp_posts WHERE post_type = "revision";
- To run the command, click 'CTRL + ENTER'.
This will remove all revisions currently stored in the database. Just make sure to enter the correct table prefix into the query. In the example above, the prefix is just wp_.
To prevent revisions from being created and stored in the first place, add this line to your wp-config.php file after the database info:
You can find the wp-config.php file in your FTP account. It will be in the primary folder for your domain.
If you still want to save some revisions, you can use the following code in place of the one above:
define('AUTOSAVE_INTERVAL', 120 ); // Default value is 60 seconds. define('WP_POST_REVISIONS', 3); // Number of revisions to save.
That limits the number of revisions to 3 and changes the auto-save value to every 2 minutes. You can change those values to something higher (or lower).
You can read more about revisions via the WordPress codex here: