Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers

up vote 2 down vote accepted

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

define( 'AUTOSAVE_INTERVAL', 60*60*60*24*365 ); // autosave 1x per year
define( 'EMPTY_TRASH_DAYS',  0 ); // zero days
define( 'WP_POST_REVISIONS', false ); // no revisions
share|improve this answer
copy that, thanks @kaiser you rock! – Ana Ban Apr 13 '12 at 13:36
update: when i add the AUTOSAVE_INTERVAL line, it makes the post editor page constantly run a javascript instruction that enables/disables the [Update] (and [Save Draft] on a new post) buttons, which also eventually makes all my other browser tabs much less responsive (gchrome18). hmm... thoughts? – Ana Ban Apr 14 '12 at 2:05
Yeah, that (propably) means that it's doing constant updates. Try to change it to 20000000000, which should be a little more than a year. – kaiser Apr 15 '12 at 0:48

This is how to modify autosave interval

And this is how to modify post revisions

So to use it in your theme, try to declare appropriate constants in your functions.php file.

share|improve this answer
thanks, @Eugene but how do i entirely disable autosave properly? i already came across this online, but it's not really disabling the autosave. an autosave can still happen no matter how long the interval is set. as for the post revision, can i just set that constant in my functions.php and not in wp-config.php? tia – Ana Ban Apr 13 '12 at 9:04

I'm also looking for how to disable autosave. But here's what I was told in a Trac ticket:

If you really need this feature you should manage the sequential IDs yourself in a custom field and then implement custom URL routing. It shouldn't be too hard to pull that off.

share|improve this answer
hi @wikicms i'm cool with the ids, but thanks for posting. useful for somebody out there for sure, or even me in the future. – Ana Ban Apr 14 '12 at 2:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.