admin管理员组文章数量:1317909
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?
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?
- Here is better solution: stackoverflow/a/30821376/2377343 – T.Todua Commented Feb 2, 2016 at 14:30
- How to disable post revision in wordpress website? – Santosh Kumar Commented Dec 11, 2016 at 19:12
3 Answers
Reset to default 15This 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
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.
Placing the defines in wp-config.php is fine until you turn WP_DEBUG on when you will get 'already defined' PHP notices in the debug.log every couple of minutes. Others claim placing these defines above the ABSPATH define will help.
However, I can categorically confirm the best place to put your defines is in a plugin, because the activated plugins are loaded before the WP default defines.
The default defines are protected with if exists tests, hence your plugin loaded defines will take precedence and will not cause a clash nor the repetitive PHP notices in the debug log.
版权声明:本文标题:How to properly turn off REVISIONS and AUTOSAVE for whole site and optionally for a custom post type only 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742028397a2415983.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论