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 number of revisions your site saves.
Running a MySQL query
If you don't want to add another plugin to 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 in to 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_.
Limiting and Disabling revisions
If you want to reduce the number of revisions saved, add this line to your wp-config.php file after the database info:
define('WP_POST_REVISIONS', 3); // Number of revisions to save. define('AUTOSAVE_INTERVAL', 120 ); // Default value is 60 seconds.
That limits the number of revisions to 3 and changes the auto-save value to every 2 minutes. It is recommended to have at least 3-5 revisions saved, but you can change those values to something higher (or lower).
To prevent revisions from being created and stored in the first place, you can use the following code in place of the one above:
You can find the wp-config.php file in your FTP account. It will be in the primary folder for your domain.
You can read more about revisions via the WordPress codex here: