This guide explains how to optimise WordPress revisions. Fine-tuning WordPress revisions improves site performance by reducing database clutter and conserving disk space.
If you do not wish to add any additional plugin to your WordPress installation, then you can run a simple SQL query to eliminate revisions.
Follow the steps:
- Setting up MySQL query:
- Navigate to the MySQL Databases page after opening your panel.
- Open phpMyAdmin and log in. Your tables will be displayed on the left.
- Select the name of your database.
- Note the prefix of the table.
You may find that the table prefix appears as “wp_” however, it is very likely to have a random string of letters such as “wp_qch9en_”. - Now, to launch the SQL command window, click the console icon at the bottom of phpMyAdmin.
- The command page for SQL opens.
- In the SQL window, copy and paste the following SQL command.
DELETE FROM wp_posts WHERE post_type = “revision”;
- To execute the command, click CTRL + ENTER.
This will erase every revision that is presently kept in the database. Just be careful to input the appropriate table prefix in the query. The prefix in the previous example is just wp_.
- Controlling and preventing revisions:
- After the database information in your “wp-config.php” file, add this line to lower the number of revisions saved:
define('WP_POST_REVISIONS', 3); // Number of revisions to save. define('AUTOSAVE_INTERVAL', 120 ); // Default value is 60 seconds.
This adjusts the auto-save value to occur every two minutes and caps the number of revisions at three. Although it is advised to preserve at least three to five revisions, you are free to adjust those numbers to one or more.
- You can substitute the above code with the following one to stop modifications from ever being made and saved in the first place:
define('WP_POST_REVISIONS', false);
The wp-config.php file is located in your FTP account. It is located in your domain’s main folder.
- After the database information in your “wp-config.php” file, add this line to lower the number of revisions saved:
This way, you can optimise WordPress revisions.
For further assistance, contact our support team.
Related Articles
How to regenerate WordPress image thumbnails using WP-CLISeptember 16, 2024
How to Add Google Maps to WordPress with a PluginSeptember 13, 2024
How to Delete WordPress Bulk Comments Using phpMyAdminSeptember 6, 2024
How to Fix the Error ‘Briefly Unavailable for Scheduled Maintenance’ in WordPressSeptember 5, 2024