实现这一点的唯一方法是在设置API之前自己将选项添加到数据库中。为此,请向register\\u settings函数添加“sanitize\\u回调”:
register_setting (\'my_options\', \'my_option_name\', array (\'type\' => \'string\', \'sanitize_callback\' => \'my_function_name\'));
然后,在函数中,自己更新选项:
function my_function_name ($value) {
update_option (\'my_option_name\', $value, false);
return $value;
}
`