In this article we’re going to walk you through two ways to delete your site’s stored revisions. The first way we’ll walk you through is a manual process directly inside of phpMyAdmin with a SQL query. If I just lost you, don’t worry! There’s also a very handy plugin you can use to achieve the same result.
- Using a SQL Query in phpMyAdmin
- Deleting WordPress Revisions in phpMyAdmin
- Delete Post Revisions with WP Optimize (plugin)
- Limit the Number of WordPres Revisions
WordPress is one of the most popular Open-Source Content Management Systems (CMS) in the world. The communities, support, and involvement from individuals to large enterprise has helped catapult WordPress to the top. Roughly 50% of our customer base has a website running off of WordPress and the popularity of WordPress continues to grow every year.
It’s a great solution for beginners and veterans alike. Though, many people using WordPress take for granted what’s under the hood. Just like a car needs an oil change, WordPress should be well maintained and checked periodically. If you’re using a CMS such as WordPress you’ll also have a database and tables where information is stored. The information stored here can vary from content on your site, information about your site, registered users, products, and more.
For anyone using WordPress you’ve probably noticed the Revisions section when you’re editing a page or post.
Overtime, the number of Revisions will continue to grow. As the number of Revisions stored in your database increase, so does the overall size of your site’s database. For a small blogger, this may not have an impact on your site’s speed. Keep in mind that database size can directly impact your site’s speed and performance. Deleting WordPress post revisions can help get rid of old information that isn’t needed and significantly reduce the size of your database.
1. Using a SQL Query in phpMyAdmin
Follow the steps below and use the following SQL query to delete revisions in phpMyAdmin.
DELETE FROM wp_posts WHERE post_type = "revision";
2. Deleting WordPress Revisions in phpMyAdmin
To delete post revisions in phpMyAdmin you’ll need to have access to your control panel. Once you’re logged into cPanel you’ll want to find the phpMyAdmin icon under the Databases section and click that icon:
You’ll want to expand the database by clicking the ‘+‘ sign. Once you’ve expanded the database you will see many rows appear most likely starting with prefix wp_. These are your database tables. WordPress page and post revisions are stored in the wp_posts table.
After you hit the Go button, the SQL query will run and delete any page and post revisions stored in your database.
3. Delete WordPress Revisions with WP Optimize
For those of you who don’t feel comfortable running a SQL query in phpMyAdmin there’s an alternative method you can use. The WP-Optimize WordPress Plugin by David Anderson will help you accomplish the same result by deleting your site’s page and post revisions for you directly through your WordPress dashboard.
You’ll want to search for, install the WP-Optimize, and activate the plugin. After you have activated the plugin you’ll see a WP-Optimize link in your WordPress dashboard’s left side navigation bar (near the bottom). Once the WP-Optimize page loads you’ll see different Run optimization actions. Search for the Clean all post revisions row and click the Run optimization button.
4. Limit the Number of WordPres Revisions
Disabling your post revisions completely or continuously deleting those revisions may be task you don’t want to repeat over and over.
Alternatively, you can add a line of code to your WordPress site’s wp-config.php, which will limit the number of post revisions your WordPress site keeps. Add the following code to the wp-config.php and adjust the number ‘5‘ to the amount of post revisions you’d like for your site to store:
/** Set number of post revisions to keep */ define('WP_POST_REVISIONS', 5);
If you have any questions don’t hesitate to reach out to support or leave a comment down below!