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(){
add_action( 'wp_print_scripts', 'disable_autosave' );

In your wp-config.php file

define( 'WP_POST_REVISIONS', false ); // no revisions
Like it.? Share it:

Comments are closed.