DEV Community

Cover image for How to Disable the Revision Feature in WordPress
GretaThemes
GretaThemes

Posted on • Originally published at gretathemes.com

How to Disable the Revision Feature in WordPress

Revision is a WordPress feature that allows you to access individual records of saved drafts, or published posts. Therefore, you can review and restore any old versions of articles. If you want to learn more about Revision, refer to this article first.

After a long time of use, records created by this feature (that is called post revisions) will increase and take a lot of space in memory. So if you don't need them anymore, you should delete them to free up space and make the website run faster. Additionally, you can disable the Revision feature in case you don't want to use it anymore. Let's see how to do it!

How to Delete All Post Revisions on the Website

Note: Before deleting anything from the website database, you should create a backup of your website to restore data in case something goes wrong. And don't forget to double-check to avoid deleting important post revisions!

How to Delete Post Revisions with Code

To delete all the existing post revisions on the website, go to phpMyAdmin SQL and run the following SQL query:

DELETE FROM wp_posts WHERE post_type = "revision";

Delete Post Revisions with Code in WordPress

This code will delete all data whose post_type is revision in the database (this means deleting all existing post revisions).

For example, before deleting, my post had 2 revisions as follows:

Post Revisions on the WordPress Website

After running the above code, all post revisions have been deleted. And as you can see, there are no more post revisions at all:

Post revisions are removed

How to Delete Post Revisions Using a Plugin

If you find using code is so difficult and complicated, you can use a plugin instead. Some cleaning plugins also support this feature. I wrote an article about the top best cleaning tools which have this feature here so you can refer to it and find a suitable one for your website.

In this article, I use WP-Sweep plugin to delete post revisions because it is quite fast, easy to use, and effective. This plugin is free and available on wordpress.org so you just need to install and activate it as usual!

After installing and activating the plugin, head to Tools > Sweep. Then, go to Post Sweep > Revisions and click Sweep to delete all post revisions on the website. Besides, you can hit the Detail button to check post revisions before deleting.

Use WP-Sweep plugin in WordPress to Delete Post Revisions

It's quite simple, right?

How to Disable the Revision Feature

In case you don't need to use the Revision feature anymore and want to disable it so that post revisions won't be auto-generated in the future, add the following code to the wp-config.php file:

define( 'WP_POST_REVISIONS', false );

To enable this feature, replace the code above with:

define( 'WP_POST_REVISIONS', true );

However, I don't recommend you disable Revision because incase some troubles happen (such as the power cut, computer crashing), you will lose the draft and can't restore it. Imagine that you're typing a long post, then the computer crash, Revision is off and you must do all again. That's truly a disaster!

Last Words

Unused post revisions are considered as a type of unused data in WordPress. Therefore, you should clean them periodically and regularly to help free up space for your site. If you want to clean up other unused data in WordPress, refer to this article. Good luck and don't forget to follow our upcoming posts to get more useful techniques about WordPress!

Latest comments (0)