使用http://codex.wordpress.org/Settings_API 要向现有组“general”添加新设置,请执行以下操作:
add_action( \'admin_init\', \'register_my_setting\' );
function register_my_setting()
{
add_settings_field(\'foo\', \'Foo settings\', \'foo_function\', \'general\', \'default\', array(\'label_for\' => \'foo\'));
register_setting(\'general\', \'foo\', \'foo value\');
}
function foo_function()
{
echo \'<input name="foo" id="foo" value="" class="regular-text ltr">\';
}
您必须修改函数以验证输入并显示保存的值。