Limit No. of Post Revisions in WordPress

function limit_post_revisions(){
	//limit the number of posts revisions that WordPress stores 
	define( 'WP_POST_REVISIONS', 3);
	define( 'AUTOSAVE_INTERVAL', 180 );
}
add_action('init', 'limit_post_revisions');

This code goes straight in functions.php