How To - WordPress

Delete or Limit the number of Revisions in WordPress

If you want to CLEAN the WordPress website database from a lot of unnecessary saved REVISIONS, here is the way to Delete or Limit the number of Revisions in WordPress.

For sake of simplicity we will refer to WordPress as WP.

We advice to limit the number of revisions to 2.

There will be 2 revisions plus one for auto-saving purpose. Older revisions will be automatically deleted as newer versions are stored.
1) FIRST BACKUP YOUR WP WEBSITE.
2) You will have to use a FTP client (manager).

3) Find the wp-confin.php file. (The files resides in your WP folder OR if you are not using a folder, in the root of your WP website.

4) Edit wp-config.php file. You can use any text editor.

5) Look for this line
define(‘WP_POST_REVISIONS’, true);
AND change it TO
define(‘WP_POST_REVISIONS’, 2);
This will limit the number of revisions to 2.

6) If there is no define(‘WP_POST_REVISIONS’, true); line just ADD define(‘WP_POST_REVISIONS’, 2); BEFORE if ( !defined(‘ABSPATH’) ) line.

7) Save the file AND using the FTP client (manager) upload the wp-config.php file to your WP website server. (same location you downloaded in the first place).

8) Rewrite the OLD file with the NEW one.

All done. You just finished the Delete or Limit the number of Revisions in WordPress task.

From now on When a POST or Page will be edited and saved, the Revisions for that page will be limited to 3 (2 + 1). If there are more that 2 revisions for that particular POST or PAGE, all older revisions will be deleted and just the last 2 will be kept.

To DELETE all your revisions and optimize the data base

Install the plugin WP-Optimize
1) WP Admin page – Left Menu / Click Plugins

2) Plugins page / Select Add new (top left of page)

3) In Search field type wp-optimize.

4) Install the plugin and ACTIVATE.
5) WP Admin panel / Left side bottom / Select WP-OPTIMIZE


6) Configure the options you want and run the tasks. (Backup FIRST)

Please navigate to Moved By Web – How TO – section to find some more helpful and worth reading articles.

Related articles

English