WordPress disable posts/pages auto save and revision – full complete guide

When you editing your posts/pages in WordPress posts/pages are automatically saved by WordPress function.When you editing big post if your contents lose because some reason,so then this function is very useful.But in some situations, for a example you editing on your post if this happens, the window automatically scrolls to the top and you lose the place where you are editing.
The “Revision” means in the database,keep the auto saved post of the current editing post/page.Then you can replaced each auto saved contents to the current post/page.
So now,I’m going to explain how to disable or completely remove this process.

Method-1

1-First go to the file editor and open the following files in these locations.
wp-admin/post.php (Line 176)
wp-admin/post-new.php (Line 36)
2-Now find this code.

   wp_enqueue_script('autosave');

Remove this or comment it like this.

   // wp_enqueue_script('autosave');

3-Save and close both files.That’s all.

Method-2

1-Open the wp-includes/function.php file.
2-Add the following wordpress hook function at the bottom.

  function disableAutoSave(){
      wp_deregister_script('autosave');
  }
  add_action( 'wp_print_scripts', 'disableAutoSave' );

3-Save and close the file.That’s all.

How to disable “Revision”

Revision can be view like this.
wp-revisions
1-Simply open the wp-config.php file and add the following script like this.
Script

   define('WP_POST_REVISIONS', false);
//this is also work
   define('WP_POST_REVISIONS', 0);

After adding like this.
wordpress-disable-revision-posts
If you want to keep limited files as revision, it can be done like this by editing wp-config.php file.

   define( 'WP_POST_REVISIONS', 5); // keep only 5 revisions.

Note:Sometime this if you did like this,revisions may be generated.So then you can execute the following mysql query in the database or use this plugin(WordPress Revision Control).

// Select all revision
  SELECT * FROM `wp_posts` WHERE post_type = "revision"

Result:
wp-revisions-db

How to delete these revisions?

//Delete all revisions
  DELETE a,b,c FROM wp_posts a
  LEFT JOIN wp_term_relationships b
  ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c
  ON (a.ID = c.post_id) WHERE a.post_type = 'revision'

You can use simple delete query like this.

  DELETE FROM wp_posts WHERE post_type = "revision";

But that removes the actual revisions (the saved copies of your posts), but doesn’t clean up after any of the associated data that is stored in the wp_term_relationships and wp_postmeta tables. The first delete query provided in the article deletes all revision-related data, as well as the revisions themselves.