Setting ‘autoload’ to ‘no’ with Settings API

The only way to accomplish this is to add the option to the database yourself before the Settings API does so. To do this, add a ‘sanitize_callback’ to the register_settings function:

register_setting ('my_options', 'my_option_name', array ('type' => 'string', 'sanitize_callback' => 'my_function_name'));

Then, in your function, update the option yourself:

function my_function_name ($value) {
    update_option ('my_option_name', $value, false);
    return $value;
}

`

Leave a Comment