Enter your keyword

Blog

How to add New Field in General Settings in WordPress

add_filter('admin_init', 'my_general_settings_on_dswebsolution');
function my_general_settings_on_dswebsolution()
{
    register_setting('general', 'general_field_dswebsolution', 'esc_attr');
    add_settings_field('general_field_dswebsolution', '<label for="general_field_dswebsolution">'.__('General Field Name' , 'general_field_dswebsolution' ).'</label>' , 'my_general_settings_dswebsolution_html', 'general');
}
function my_general_settings_dswebsolution_html()
{
    $value = get_option( 'general_field_dswebsolution', '' );
    echo '<input type="text" id="general_field_dswebsolution" name="general_field_dswebsolution" value="' . $value . '" />';
}

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.