How to properly turn off REVISIONS and AUTOSAVE for whole site and optionally for a custom post type only

Is there a hook/function combination that can be added to my theme’s functions.php to properly disable REVISIONS and AUTOSAVE for the entire wordpress installation? What about if just for a certain custom post type? Searching online gives various hacks from deregistering scripts to tampering with core files. What’s the acceptable/correct way to do this?

3

This should be placed in your wp-config.php (and no where else):

define( 'AUTOSAVE_INTERVAL', 60*60*60*24*365 ); // Set autosave interval to 1x per year
define( 'EMPTY_TRASH_DAYS',  0 ); // Empty trash now: Zero days
define( 'WP_POST_REVISIONS', false ); // Do not save andy revisions

Leave a Comment