add_filter('admin_init', 'general_settings_register_fields');
function general_settings_register_fields()
{
register_setting('general', 'test_field', 'esc_attr');
add_settings_field('test_field', '<label for="test_field">'.__('Test Field' , 'test_field' ).'</label>' , 'general_settings_fields_html', 'general');
}
function general_settings_fields_html()
{
$value = get_option( 'test_field', '' );
echo '<input type="text" id="test_field" name="test_field" value="' . $value . '" />';
}
No comments:
Post a Comment