How to Safely Delete WordPress Revisions: An Easy Guide
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.
Is your WordPress site feeling sluggish and frustrating to you? The culprit might be the number of revisions stored in your database. Every minor edit to a post or page is saved as a revision, building up and dragging down performance. These unnecessary revisions clog your database, making it inefficient.
Think of your site like a stack of papers; each new edit adds another sheet. Over time, the stack grows taller and harder to manage. This buildup of revisions complicates database management and slows down your site’s performance.
But don’t worry—we are here to help! Thanks to countless hours spent testing different features and plugins on WordPress sites, we know how annoying it can be when your site isn’t performing at its best, with these instructions to delete unnecessary post revisions and tidy up your database safely.
TL;DR: Deleting your WordPress revisions can significantly improve your site’s performance. However, it is crucial to always back up your entire site first to avoid data loss or site issues from incorrect queries or accidental deletions. This precaution ensures you can restore your site if something goes wrong.
What are WordPress revisions?
WordPress revisions are like the version history for your posts, pages, or custom content types. Each time you click on Save Draft or Update, WordPress saves a snapshot of your changes. These revisions capture and track every change you make to your content, allowing you to monitor alterations over time.
One of the major benefits of revisions is that they allow users to compare different versions of their content. This makes it incredibly easy to pinpoint specific changes, correct mistakes, or recover previous versions if necessary. Whether you’ve accidentally deleted an important section or simply want to revert to an earlier draft, WordPress revisions provide a safety net for content management.
However, despite these advantages, it’s essential to manage revisions properly. Over time, an excessive number of revisions can impact your database size, leading to a slower, less efficient website.
By regularly deleting unnecessary revisions, you can improve your site’s performance, ensure quicker load times, and maintain an optimized database.
Note: Always backup your entire site using a reliable backup plugin. If something were to go wrong during revision deletions, you would have a safety net to fall back on.
Methods to delete WordPress revisions
To keep your WordPress site running smoothly, it’s important to periodically delete unnecessary revisions. Here are some methods you can use to clean up these revisions:
Use a plugin to delete revisions
One of the easiest ways to manage and delete WordPress revisions is by using a dedicated plugin like Companion Revisions Manager. Here’s how to go about it:
1. Install and activate the plugin: Begin by logging in to your WordPress admin area. In the left-hand menu, navigate to Plugins and then click on Add New. In the search bar, type “Companion Revisions Manager.” Once you find it, click Install Now. After the installation is complete, activate the plugin by clicking the Activate button.
2. Access plugin settings: Once activated, navigate to the plugin settings by going to Tools in the left-hand menu and then selecting Revisions.
3. Delete existing revisions: Inside the Revisions settings panel, you’ll find an option labeled Delete existing revisions. Select this option to proceed. Once selected, the plugin will delete all existing revisions from your database.
Manually delete revisions
For those who prefer a hands-on approach or don’t wish to rely on plugins, manually deleting WordPress revisions through phpMyAdmin or your web host’s database manager is an effective method. Although it requires a bit more technical know-how, this method offers a direct way to clean up your database.
Note: Always take a backup of your site before making changes to your database. Proceed with caution as improper queries or commands within phpMyAdmin or your web host’s database manager can affect your website’s functionality.
1. Access your phpMyAdmin: Begin by accessing the control panel offered by your web hosting account. Once you’re in the control panel, look for the phpMyAdmin icon or link; click on it.
2. Navigate to the SQL tab: In the phpMyAdmin interface, you’ll see a list of databases on the left-hand side. Find and select the database associated with your WordPress site. Next, navigate to the SQL tab. This allows you to run custom queries on your database.
3. Enter the query: In the SQL query box, copy and paste the following command:
DELETE FROM wp_posts WHERE post_type = "revision";
This query is designed to target and delete all post revisions within your database.
Once you’ve entered the query, click the Go button to execute it. phpMyAdmin will then process the command and remove all revisions from your WordPress database.
Set a limit to the number of revisions to retain
A. Using a plugin
One of the simplest methods to control the number of revisions is by using a plugin, like Companion Revisions Manager. Here’s how:
1. Navigate to plugin settings: After installing and activating the Companion Revisions Manager plugin, go to your WordPress Dashboard. From there, navigate to Tools and then click on Revisions.
2. Select the number of revisions: Inside the Revisions section, you’ll see an option labeled Number of revisions. Set your desired number of revisions to retain.
B. Edit your wp-config.php file
If you prefer a more hands-on approach, you can manually set a revision limit by editing your WordPress configuration file. Follow these steps:
Note: This method requires technical know-how. Ensure you back up your site first, as errors made while editing core files can result in issues.
1. Connect to your site via FTP: Open your preferred FTP client like Cyberduck and connect to your website’s server. Check with your hosting provider for your credentials.
2. Locate your wp-config.php file: Navigate to your WordPress root directory, usually named public_html or www. Locate the wp-config.php file in the root directory. Open this file with a text editor like Visual Code Studio.
3. Edit your file: Add the following line of code before the line that says, That’s all, stop editing! Happy blogging:
define('WP_POST_REVISIONS', 5);
Replace 5 with the number of revisions you want to retain.
4. Save and upload the file: After making the necessary changes, save the file, right-click, and Upload it back to the server via your FTP client.
This command will enforce a maximum number of revisions, deleting older ones, and keeping only the specified number of the latest versions.
Benefits and drawbacks of WordPress revisions
Understanding the benefits and drawbacks of WordPress revisions can help you make informed decisions about managing them on your site:
Upsides of WordPress revisions
- Ability to roll back changes.
- Track changes made by multiple authors.
- Recover content.
- Keep a history of edits for reviews.
Downfalls of WordPress revisions
- Database bloat.
- Storage consumption.
- Increased backup size.
- Performance impact.
Troubleshooting common issues while deleting revisions
When deleting WordPress revisions, you may face some common issues. But don’t worry, we’re here to help you troubleshoot them efficiently.
Timeout issues
Sometimes, deleting many revisions via a plugin can take too long, exceeding the server’s execution time limit.
Fix: Choose a plugin like WP-Sweep that allows you to delete revisions in smaller batches. Alternatively, you can increase the maximum execution time by adding `set_time_limit(300);` to your wp-config.php file.
Plugin conflicts
Other plugins, especially those managing post revisions, can conflict with the revision deletion plugin.
Fix: Use one plugin that allows you to manage and delete revisions, such as the Companion Revisions Manager.
Slow performance
The deletion process might slow down your site temporarily if a plugin is handling a large number of revisions.
Fix: Schedule the deletion during low-traffic periods and monitor the server performance to ensure everything runs smoothly.
Database errors
If you are manually deleting revisions, mistakes in SQL queries might lead to incorrect deletions or database errors.
Fix: Restore your site from a backup and try the deletions again after carefully reviewing and testing your SQL queries in a staging site.
Parting thoughts
Deleting WordPress revisions can significantly improve your database performance and speed up your site. Note that it is non-negotiable for you to take a backup of your entire site before performing any additions or deletions. Consider investing in a good backup plugin like BlogVault.
For a straightforward, automated approach, consider using plugins that handle the process for you. However, if you prefer having more control, manually deleting revisions through phpMyAdmin is an option—just be sure to follow the steps carefully to avoid issues. Setting a revision limit in your wp-config.php file can also help prevent future database bloat.
Regular maintenance of your revisions is essential to ensure your content remains intact and your site stays optimized.
FAQs
How do I delete revisions on WordPress?
Deleting revisions on WordPress can be done by using a plugin like Companion Revision Manager. Alternatively, if you prefer a more hands-on approach, you can manually delete revisions using SQL queries through phpMyAdmin. But always remember to back up your site before making any deletions!
How many revisions does WordPress keep?
By default, WordPress saves an unlimited number of revisions for your posts and pages. This means every time you click Save Draft or Update, a new revision is stored. However, you can limit the number of revisions by adding the following line to your wp-config.php file:
define(‘WP_POST_REVISIONS’, 5); This limits the revisions to the last five changes.
Where are WordPress revisions stored?
WordPress revisions are stored in your site’s database, specifically in the wp_posts table. Each revision is treated as a separate entry tied to the original post or page. Over time, these entries can accumulate and bloat your database, affecting performance.
Do revisions slow down WordPress?
Yes, accumulating numerous revisions can slow down your WordPress site. Every stored revision adds to the database size, which can lead to slower query times and overall reduced performance. Regularly cleaning up unnecessary revisions can help keep your site running efficiently.
Does WordPress automatically save changes?Yes. WordPress’s auto-save feature automatically saves your post or page every 60 seconds while you’re editing. These auto-saves are designed to prevent data loss in case of browser crashes or internet issues. Auto-saves are also stored as revisions in your database.
Tags:
Share it:
You may also like
Understanding And Fixing “Briefly Unavailable for Scheduled Maintenance” in WordPress
Seeing “Briefly unavailable for scheduled maintenance. Check back in a minute” on your WordPress site can be nerve-wracking. Minutes turn into an hour, and your site remains inaccessible. You start…
How To Create WordPress Test Site (Step-by-Step)
What if your Elementor update breaks your WordPress site? It is a scary situation that you and countless WordPress users might have faced many times. You cannot let that happen…
WooCommerce Staging: Complete Guide from Setup to Testing
Imagine customers facing errors while buying from your site and losing their orders. All this because a theme update failed. Experimenting with changes on your live site can damage your…
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.
Updating Everything Manually?
But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.
Backup Your WordPress Site
Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.