In WordPress, every time you edit a post, a copy of the previous version is saved in the database. This process lengthens the archive of your blog and affects the performance of your server. Today in this article we will learn how to delete WordPress revisions and reduce the number of saved ones. Are you ready? Let’s start …
The WordPress database is the heart of your blog and keeping it efficient is important to increase the speed of your site. Its size is one of the factors that most affect performance, so unnecessary data deletion is one of the things you should do with regularity.
Post and page reviews are unnecessary and it is therefore recommended to delete them. There are several plugins that do database optimization but what I want to explain today is how to prevent revisions from being stored on the database … in a few words, we see how to minimize or delete WordPress revisions.
Reduce the number of revisions
You can limit the number of revisions saved by modifying the wp-config.php configuration file that is in your server root. Of this file, I have already spoken to you in a previous article and to change it you have to access your hosting server file system with an ftp client or through the administrative interface that your hosting provider makes available to you.
The parameter you want to modify is WP_POST_REVISIONS and you can set it to;
define ('WP_POST_REVISIONS', 3);
limiting the number of revisions saved to 3. If you want to make sure that no version of your posts is saved, you can set it to FALSE so
define ('WP_POST_REVISIONS', false);
Clear WordPress revisions
Once you have set up the wp-config.php file to make sure that the revisions are not saved, you must delete those in the database. The fastest way to do this without installing a plugin is to run a SQL command from the host administration interface.
The command to delete WordPress revisions is:
DELETE FROM wp_posts WHERE post_type = "revision";
but if you prefer not to touch the SQL code, you can delete WordPress revisions by installing the wp-optimize plugin. Uninstall the plugin after deleting revision.