Post Revisions in WordPress play a vital role in restoring the previous/old versions of a page or post.
In simple words, WordPress saves content upgrades every 60 seconds. We can find the updated content under ‘post revisions’ on the editor page.
If you run a multi-author WordPress blog, concurrent post revisions populate your site database. After you publish your content, you don’t need to keep previous post revisions, and you can safely delete them for improved database performance.
With that clarified, you can also limit or disable post revisions if you’re the only author on your WordPress website.
In today’s write-up, you can learn how to limit post revisions in WordPress. It helps you keep your site’s database clean and enables you to speed up content editing in WordPress.
What are the post revisions?
When you make changes to a published post or save a Draft, WordPress saves the updated version of the content.
For concurrent content upgrades, WordPress keeps saving the changes and uses them to revert to the previous versions of the post. The entire history of post upgrades refers to the WordPress Revisions and can be used to restore the old versions of a page or post.
How to manage post revisions in WordPress?
Limit post revisions in WordPress
Did you know about the WordPress wp-config.php file?
It is the core configuration file in the root of a WordPress website. You can make changes to the wp-config.php file and extend or change the performance of your WordPress website. Read more about the importance and use of the wp-config.php file.
To limit the post revisions, add the following code to the wp-config.php file and save changes at the end. (Add the code above the ABSPATH, right below the table prefix syntax)
The above syntax limits the post revisions up to 3. You can also put 5, 10, or desired number in the syntax.
To make changes to the (wp-config.php) file, you’ll need to log into Hosting cPanel and use the Edit option to make changes. Alternatively, if you’ve configured FTP for your website, you can also use FileZilla or any other FTP client to edit the wp-config.php file.
Disable post revisions
You can also entirely disable the post revisions in WordPress. However, we recommend doing this for single-author Blogs, along with taking backups regularly.
To completely disable the post revisions, add the following code to the wp-config.php file.
Add the code above the ABSPATH, right below the table prefix syntax.
Delete all post revisions from the database
After you publish a blog page or post, you don’t need to keep previous post revisions in the database.
You can safely remove them to clean up the WordPress database.
To get started, open PhpMyAdmin and run the following SQL query.
DELETE FROM wp_posts WHERE post_type=”revision”;
You can find PhpMyAdmin in the Hosting cPanel.
Deleting post revisions through PhpMyAdmin requires technical knowledge. At least, you’ll need to find PhpMyAdmin in the Hosting cPanel and proceed to run the mentioned query via SQL command line.
If for example, you enter a wrong SQL query, you may lose sensitive data in the database. Above all; take proactive measures to keep your site safe, such as taking backups on a regular basis.
Having said that, here is a simple strategy to remove all the post revisions from your site’s database.
WordPress plugins play a vital role for beginners. You can install and use a plugin for removing all post revisions from the WordPress database.
Proceed to use the Plugins -> Add New plugin feature in the WordPress dashboard. Search for ‘wp-sweep’ or ‘better delete revisions’ to install the plugin.
Once finished, head over to plugin’s dashboard and use the appropriate options to remove all post revisions from your WordPress database.
Keeping post revisions in WordPress helps you stay away from losing your content.
However, you can limit post revisions in a single-author WordPress website. It helps you keep your site database clean.
You can manage post revisions by playing with the wp-config.php file. It is the core configuration file at the ROOT of a WordPress website and can significantly improve or alter WordPress functionality.
For limiting or disabling post revisions, you’ll need to add particular code snippets to the wp-config.php file. On the other hand, if you want to remove all the post revisions from your site database, you’ll need to use the PhpMyAdmin SQL command-line interface. Alternatively, if you don’t prefer using PhpMyAdmin, use the ‘WP-Sweep’ or ‘Better Delete Revision’ plugin to remove all post revisions from your site database.
Did you find this tutorial helpful? If you’re facing issues limiting or disabling post revisions in WordPress, let us know by joining the discussion in the comments.