Best way to prevent autosave and revisions in wordpress

wordpress by default tries to be clever by saving revisions to your posts frequently. This can be a good thing if everything went kaboom and you won’t loose too much data. The downside is that your database will become bloated really quickly, meaning that queries will become slower as time goes by. To stop wordpress from saving revisions, the best thing to do is to deregister the javascript responsible for the autosave.

// disable autosave throughout the site. Note that this will also break the preview changes. If you don't need preview changes, this is the best solution.
function disable_autosave(){
  wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'disable_autosave' );

In your wp-config.php file

define( 'WP_POST_REVISIONS', false ); // no revisions

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.