Remove Post revisions from WordPress Database
The post revisions are a feature in WordPress blog engine. When we edit or update a post or page, WordPress keep old data as a revision in WordPress database.
This is extremely helpful in certain situation because we can easily restore old data from these revisions.
But when we have more posts & pages in our blog, certainly we have a large database. Additional to these actual posts & pages, we have more than its double revisions in our database.
These stored post revisions don’t have any direct impact on our WordPress performance until we have a large database. But keeping our database as small & optimized is a an important “to do” in such applications.
So now we are going to delete all our WordPress post revisions from database using a simple SQL command.
DELETE FROM wp_posts WHERE post_type = "revision";
We can use MySQL command-line interface, phpMyAdmin, SQLyog or other MySQL GUI tools to perform this action. So use this tip & optimize our WordPress database to perform well.
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- Automating Code Linting with GitHub Actions for WordPress Plugins
- Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
- The Ultimate Guide to Indexing in Database Design
- Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
- A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.