The perfect implementation of WordPress prohibit article revision and automatic saving method _php instance

Source: Internet
Author: User
Use WordPress So long has been very annoying WordPress article revision and auto-save function, also used Super switch plugin can prohibit WordPress article revision and auto-save function, but their blog plugin has enough, Had to modify the WordPress main program to achieve the prohibition of article revision and automatic saving function. But this method has a bad place is that every time the WordPress upgrade, you have to change the WordPress source code, it is very troublesome. Today accidentally bumped into the ZWW blog found this non-plug-in without modification of the code to implement the WordPress ban article revision and automatic saving method, share to everyone!

The use of the method is simple, as long as the functions.php in the theme directory to add the appropriate code, the code is as follows:

Copy the Code code as follows:
/* Remove auto-save and revision */
Remove_action (' pre_post_update ', ' wp_save_post_revision ');
Add_action (' wp_print_scripts ', ' disable_autosave ');
function Disable_autosave () {
Wp_deregister_script (' AutoSave ');
}

Test environment: WordPress 3.1.2, the principle of more than 3.0 support.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.