How To Disable WordPress Post Revisions
Post revisions are one of many great features provided by WordPress. It is a system designed to save a record automatically for every saved draft and published updates. It indicates what has been added, removed or changed from posts. With a revision system, you can simply revert to previously saved revisions with a single button click.
Although this is a great feature, it is important to note that revisions inevitably, will take up space in your database when your website growing up. This is a huge issue for a website with the limited size of database especially blog which hosted on the shared hosting plan.
Assume you have a hundred of drafts or published posts, you may also possibly have few hundreds to thousands of revisions. This may lead to the huge size of a database. And in this article, I would like to share with you how to disable WordPress post revisions which also one of few ways to effectively decrease your database size.
This article is part of best useful tips for your WordPress.
There is a popular WordPress myth that said storing multiple post revisions will ultimately slow down your website. From my personal experience, however, this is not quite true.
It may probably slow your website a little bit but there is no significant impact on performance. WordPress is written smart enough to ignore revisions while rendering front-end. And with a good hosting provider, this shall not become an issue for you even you are using shared hosting.
How To Disable WordPress Post Revisions
By default, each post which currently being edited will be automatically saved every 60 seconds with a maximum of one autosave per user. This autosave will not overwrite your published posts but instead; will send you a warning if you have more recent backup than your current published content with a link to restore it.
To do this, open up your WordPress wp-config.php file and add 2 of the following configurations right above the "/* That's all, stop editing! Happy blogging. */" line. Before you edit any of WordPress file, please make a backup copy so you can switch back in any case.
The first configuration line is define('AUTOSAVE_INTERVAL', $time); where $time is a delay value in seconds which by default is 60 seconds. Second configuration you need to add is define('WP_POST_REVISIONS', $value); where $value can be set depending on your need:
- True - Every revision will be saved (this is default setting).
- False - Will not save any revision except the one autosave in each post.
- Integer - Define max number of revisions that allowed to be stored (with +1 autosave per post) on each post where previous revisions will be automatically overwritten. Must be more than 0 value.
In this article, we want to completely disable our post revisions. So let's add 2 of this following lines below to our wp-config.php. This configuration will create an autosave automatically every 5 minutes instead of 1-minute while disabling post revisions completely.
If in case, you still want to keep using post revisions feature but with higher delay and limited revisions amount, feel free to change the configuration.
How To Remove All Existing Revisions
Although with the above method will disable your future post revisions, however, it will not delete the existing ones. Still, you can easily delete your previous post revisions by using a plugin or another approach.
I have been using WP-Sweep plugin for a quite long time without encountering any issue. Aside from deleting post revisions, it also takes care of your auto drafts, deleted/unapproved comments, orphaned/duplicate meta, optimize your database and more.
Or, you can try WP-Optimize, one of the most popular WordPress cleaner. It removes all unnecessary data such as deleted/spam comments, pingbacks/trackbacks, and expired transient options.
Moreover, it comes with scheduled cleaning feature and full details about all optimization you can do. Additionally, they also offer premium service for even more great features.
In addition to the plugins above, you may as well want to check out Bulk Delete plugin which offers similar features. Nevertheless, for those who prefer not to use a plugin can try the manual way. But, I would only recommend this for experienced users.
Aside from using a plugin, you can also delete your existing post revisions by visiting your PHPMyAdmin and run the following SQL query. Before that, don't forget to backup your database because changes you going to make will be irreversible.
To summarize, post revisions is indeed a great feature. But for a blog with a limited database size, this is one of many things that need to put into consideration. So please kindly share with us in the comment section. Will you use post revisions, limit the revisions or disable it completely.
He is a web developer, a programmer, and a computer technician. He obsessed with coding and enjoy learning new things. In his spare time, he likes to play online games, musical instruments or watching anime and movies.