Discover how to delete WordPress revisions manually or with plugins and reduce database size to improve website performance and security. Learn about the benefits of disabling revisions and the top plugins for managing them.
Why Delete Revisions in WordPress?
WordPress is one of the most popular platforms for creating and managing websites, and it comes with a built-in feature called revisions. Revisions automatically saves every draft of a post or page that you make, which can be useful if you need to go back to an older version. However, revisions can also have a negative impact on your website’s performance, security, and database size. In this section, we’ll explore why you should consider deleting revisions in WordPress and the benefits it can bring.
Reduce Database Size
Every time you save a draft or make a change to a post or page, a new revision is created and stored in your database. Over time, this can lead to a bloated database, which can slow down your website and make it harder to manage. By deleting revisions, you can significantly reduce the size of your database and improve its efficiency.
One way to check the size of your WordPress database is to use a plugin like WP-Optimize. This plugin allows you to optimize your database by cleaning up unwanted data, including revisions. By removing these revisions, you can free up valuable space in your database and improve its overall performance.
Improve Website Performance
Revisions can also have a negative impact on your website’s performance. Each revision creates an additional HTTP request, which can slow down your website and make it less responsive. This can be particularly problematic for mobile users, who may have slower internet connections.
By deleting revisions, you can reduce the number of HTTP requests needed to load your website, which can improve its speed and performance. This can lead to a better user experience and increase the amount of time visitors spend on your site.
Enhance Security
Finally, revisions can also pose a security risk to your website. Each revision contains a copy of the content you’ve created, including any sensitive information that may be included in the post or page. This can include login credentials, personal information, or financial details.
By deleting revisions, you can reduce the amount of sensitive information stored on your website and reduce the risk of a security breach. This can help protect your website and your visitors from potential threats.
How to Manually Delete Revisions in WordPress?
Step 1: Accessing the WordPress Database
Before you can start deleting revisions, you’ll need to access your WordPress database. There are a few ways to do this, but the most common method is through cPanel or phpMyAdmin.
To access your WordPress database through cPanel, follow these steps:
- Log in to your cPanel account.
- Scroll down to the Databases section and click on phpMyAdmin.
- Select your WordPress database from the left-hand menu.
- You should see a list of tables in your WordPress database. Look for the wp_posts table and click on it.
Alternatively, you can access your WordPress database through phpMyAdmin:
- Log in to your phpMyAdmin account.
- Select your WordPress database from the left-hand menu.
- Look for the wp_posts table and click on it.
Once you’ve accessed your WordPress database, you can start deleting revisions.
Step 2: Running SQL Queries
One way to delete revisions in WordPress is by running SQL queries directly on your database. This method requires a bit of technical knowledge, so if you’re not comfortable with SQL, you may want to skip to the next section.
To delete revisions using SQL, follow these steps:
- Open your WordPress database in phpMyAdmin.
- Click on the SQL tab.
- In the SQL query box, enter the following command:
DELETE FROM wp_posts WHERE post_type = "revision";
Click the Go button.
This SQL query will delete all revisions from your WordPress database.
Note: Before running any SQL queries, it’s important to back up your database. If something goes wrong, you’ll be able to restore your database to its previous state.
Using a Plugin
If you’re not comfortable running SQL queries, you can use a plugin to delete revisions in WordPress. There are several plugins available that can help you manage revisions, but we’ll focus on three popular options: WP Revisions Control, Advanced Database Cleaner, and WP-Sweep.
WP Revisions Control allows you to control how many revisions are stored for each post or page. You can set a limit on the number of revisions, or disable them entirely. This plugin also includes a feature that allows you to delete all revisions with a single click.
Advanced Database Cleaner is a free plugin that allows you to delete revisions from your database. It can also delete orphaned items, spam comments and more.
WP-Sweep is a another free plugin that allows you to delete tons of unused data from your database. This plugin uses proper WordPress delete functions as much as possible to ensure that it is compatible with latest WordPress version.
To use any of these plugins, simply install and activate them on your WordPress site. You should then be able to access the plugin’s settings and start managing your revisions.
For a one time usage, I recommend WP-Sweep. If you want to schedule and run the clean up in the background at a fixed interval, use Advanced Database Cleaner.
How to Disable Revisions in WordPress?
If you’re looking to disable revisions in WordPress, you have a few options available to you.
Editing wp-config.php file
One of the easiest ways to disable revisions in WordPress is by editing the wp-config.php file. This file is located in the root directory of your WordPress installation and contains important configuration settings for your website.
To disable revisions in WordPress using this method, follow these steps:
- Log in to your WordPress dashboard.
- Navigate to the root directory of your WordPress installation.
- Locate the wp-config.php file and open it in a text editor.
- Add the following line of code to the file:
define('WP_POST_REVISIONS', false);
Save the file and upload it back to your server.
Once this is done, WordPress will no longer store revisions for your posts and pages.
Using a Plugin
Another option for disabling revisions in WordPress is by using a plugin. There are several plugins available that can help you achieve this, including the Disable WP Revisions, and Disable Post Revision.
To disable revisions using a plugin, follow these steps:
- Log in to your WordPress dashboard.
- Navigate to the Plugins section and click on Add New.
- Search for the plugin of your choice and install it.
- Activate the plugin.
- Follow the instructions provided by the plugin to disable revisions.
Using a plugin can be a convenient and hassle-free way to disable revisions in WordPress, especially if you’re not comfortable editing files manually.
Editing functions.php file
If you’re comfortable with editing files manually, you can also disable revisions in WordPress by editing the functions.php file. This file is located in the wp-content/themes directory of your WordPress installation and is used to define custom functions for your theme.
To disable revisions in WordPress using this method, follow these steps:
- Log in to your WordPress dashboard.
- Navigate to the wp-content/themes directory of your WordPress installation.
- Locate the functions.php file for your theme and open it in a text editor.
- Add the following code snippet to the file:
function disable_post_revisions() {
return 0;
}
add_filter('wp_revisions_to_keep', 'disable_post_revisions');
Save the file and upload it back to your server.
With this code added to your functions.php file, WordPress will no longer store revisions for your posts and pages.
Benefits of Disabling Revisions in WordPress
While revisions can be useful for keeping track of changes, they can also slow down your website, take up valuable database space, and even pose a security risk. That’s why many website owners choose to disable revisions altogether.
Increased Website Speed
One of the main benefits of disabling revisions in WordPress is that it can significantly increase your website speed. Every time you save a post or page, WordPress creates a new revision, which can quickly add up to a large number of files in your database. This can slow down your website and make it more difficult for visitors to navigate. By disabling revisions, you can reduce the number of files in your database and improve your website’s speed.
Improved Security
Another benefit of disabling revisions is improved security. Every revision that’s stored in your database contains sensitive information such as your username, password, and other personal details. If your website is hacked, these revisions could be accessed by the attacker, leaving your website and your visitors at risk. By disabling revisions, you can reduce the amount of sensitive information that’s stored in your database and improve your website’s security.
Reduced Database Size
Finally, disabling revisions can help reduce the size of your database. Every revision that’s saved takes up valuable space in your database, which can quickly add up over time. This can slow down your website and make it more difficult to manage. By disabling revisions, you can reduce the size of your database and make it easier to manage your website.
- Are you currently using revisions on your WordPress website?
- Have you noticed any performance issues as a result of using revisions?
- Would you consider disabling revisions to improve your website’s speed and security?
| Benefit | Description |
|---|---|
| Increased Website Speed | Disabling revisions can reduce the number of files in your database, improving your website’s speed. |
| Improved Security | By reducing the amount of sensitive information that’s stored in your database, disabling revisions can enhance your website’s security. |
| Reduced Database Size | Disabling revisions can help reduce the size of your database, making it easier to manage your website. |
Frequently Asked Questions
What are Revisions in WordPress?
Revisions in WordPress are essentially a record of changes made to a post or page. Whenever you make changes to your content and save it, WordPress automatically creates a new revision. This helps you keep track of all the changes you have made to your content over time.
Revisions are particularly useful in collaborative environments, where multiple users may be working on the same content. They allow you to see who made what changes and when, making it easier to troubleshoot any issues that may arise.
How Many Revisions Does WordPress Store?
By default, WordPress stores an unlimited number of revisions for each post or page. While this can be useful for keeping a detailed history of your content, it can also lead to a bloated database and slower website performance.
Fortunately, you can adjust the number of revisions WordPress stores by adding a simple line of code to your wp-config.php file. For example, if you wanted to limit the number of revisions to three, you would add the following code to your wp-config.php file:
define( 'WP_POST_REVISIONS', 3 );
This will limit WordPress to storing only the three most recent revisions for each post or page.
Can You Recover Deleted Revisions in WordPress?
Once a revision is deleted in WordPress, it is gone for good. However, there are a few steps you can take to minimize the risk of accidentally deleting revisions in the first place.
First, you can use a plugin like WP Revisions Control or Better Delete Revision to manage your revisions more effectively. These plugins allow you to delete specific revisions or bulk delete older revisions, reducing the risk of accidentally deleting important revisions.
Second, you can disable revisions altogether by adding the following code to your wp-config.php file:
define( 'WP_POST_REVISIONS', false );
This will completely disable revisions in WordPress, ensuring that they cannot be accidentally deleted or cause any bloat in your database.
In conclusion, revisions are a powerful feature in WordPress that allow you to track changes to your content over time. While they can be useful, it’s important to manage them effectively to avoid database bloat and slow website performance. By limiting the number of revisions stored, using plugins to manage revisions, or disabling revisions altogether, you can ensure that your website runs smoothly and efficiently.



