Snippets

How to Limit or Disable WordPress Post Revisions

Limit the number of posts revisions that WordPress stores in the database.

edit wp-config.php file in WordPress root:

define( 'WP_POST_REVISIONS', 3 );

WP_POST_REVISIONS:

  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except the one autosave per post)
  • (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.

 

Example:-

Step 1:-

First we will need to open up your wp-config.php file. This is located in the root of your WordPress site.

Step 2:-

Insert the following code in wp-config.php file.

//disable WP Post Revisions
// Change auto save interval
define('AUTOSAVE_INTERVAL', 300); // seconds
// Disable WP Post Revisions
define('WP_POST_REVISIONS', false);

or

// Limit WP Post to 3
define('WP_POST_REVISIONS', 3);

Note: This needs to be inserted above the ‘ABSPATH’ otherwise it won’t work.

Recent Posts

Adding or Including custom post type to default WordPress loop

Adding or Including custom post type to default WordPress loop by altering the 'pre_get_posts' function.…

5 years ago

Multisite – List Recent Posts Across an Entire Network

In Multisite, List Recent Posts Across an Entire Network by using custom query or WP_Query…

5 years ago

Disable update notification for individual plugins / All

code for the plugin file itself:- [crayon-6635c168e3967386191902/] I like to put this in the actual…

5 years ago

How to change the WordPress permalink structure to remove dates from the URLs

Switching the permalink structure from /year/month/post-slug to just /post-slug is easy by going to Settings…

6 years ago

Limit character in content and title in wordpress

[crayon-6635c168e3c29434427728/] or with readmore [crayon-6635c168e3c2f468609938/]  

6 years ago

Hide page visual editor if certain template is selected

[crayon-6635c168e3d64451222019/]  

6 years ago