How to remove the Revisions in WordPress Posts?

Recently, I found my blog site was loading much more slowly and I did lots of works to research the reasons, finally I saw mySQL data was much heavier than my last check. The reason to lead to my data heavier was that there were too many revisions on my WordPress posts. How to delete WordPress revisions in every post? Here I'd like to share a bit experience and guide you how to remove the revisions in MySQL phpMyAdmin


1st, please backup your database and website files - Important!

Please aware it's important to back up your blog site files and SQL database in the first step, in case you can restore your whole website once you had done any mistake manipulations. If you're using cPanel control panel, the website and SQL backups are very simple, you just need to login your hosting control panel and click "Backups", and then can choose to download the backup file of each MySQL database at there. And for website file backups, it's also very easy, you just need to click "File Manager" in the cPanel and you'll be able to find the folder of your blog site installed, then click "Compress" tab on the top of web browser to proceed.

2nd, you can login phpMyAdmin to delete revisions once you've done the backups

You can click "phpMyAdmin" in the cPanel control panel and it'll bring you to a new page in the browser.

phpmyadmin phpMyAdmin-Database phpMyAdmin-SQL

DELETE FROM wp_posts WHERE post_type = "revision";

You can copy the code above and in the end, please click "Go" on the right bottom of the form and that's fine. If you've encountered any difficulties, please feel free to leave a comment and I'm glad to give you an assistance.

How to stop the revisions in the new posts?

And if you'd like to stop the revisions automatically generated in your posts, you can add these codes into your "wp-config.php" file (in the root of your blog site).

define('WP_POST_REVISIONS', false);

But I don't recommend you to deny the function, sometimes when you write something wrong in the post, the revisions can help you restore articles easily. Here I recommend you can add these codes into your "wp-config.php" file which can help you keep 5 revisions at most by default.

define('WP_POST_REVISIONS', 5); define( 'AUTOSAVE_INTERVAL', 120);

If you've added these codes into the configuration file, it'll help you save the latest 5 post revisions of any articles (the value can be changed without any risk). And I've increased the autosave interval period to 120 sec, the default autosave value is 60 sec. Once you've done all of these, I believe your blog site will be lightened and the whole site performance will be improved a lot.

About the Author: Angela Will

A professional online explorer and experienced web designer, worked for a web hosting review website and loving to share her experience with any other developers and bloggers.