Читать книгу Professional WordPress Plugin Development - Brad Williams - Страница 85

Toggling the Autoload Parameter

Оглавление

The autoload parameter is set when an option is created with add_option() and is not supposed to change afterward. With this said, if you believe that it would improve your plugin's efficiency to modify the autoload behavior, it is possible and easy: simply delete and then re‐create the option with an explicit autoload parameter.

<?php function pdev_plugin_recreate_options() { // get old value $old = get_option( 'pdev_plugin_admin_options' ); // delete then recreate without autoload delete_option( 'pdev_plugin_admin_options' ); add_option( 'pdev_plugin_admin_options', $old, '', 'no' ); } ?>

Professional WordPress Plugin Development

Подняться наверх