How to get specific setting by settings_fields()?

I am working on a plugin and on the settings page I have 2 settings and I want to show Only one setting backgroundColor so how should i do that?

This is the code:

form action=options.php method=post
?php
    settings_errors();

    settings_fields( 'bg_color' );  ** I want only background settings to show how i can do it correclty?**

    do_settings_sections( 'plugin-style' );

    submit_button( __('Save settings', 'trans') );
                                        ?
/form


        /* Add Settings Field for Background Color */
    add_settings_field(
        'background-color',
        __('Background Color', 'trans'),
        'plugin_background_color_ca',
        'plugin-style',
        'style-settings-section-2',
        array(
            'name'      = 'bg_color',
            'id'        = 'style-settings-background-color',
            'class'     = 'style-settings-background-color',
            'options'   = $style_opts,
        )
    );

    /* Add Settings Field for Font Size */
    add_settings_field(
        'st-search-font-size',
        __('Font Size', 'trans'),
        'plugin_font_size_ca',
        'plugin-style',
        'style-settings-section-2',
        array(
            'name'      = 'font_size',
            'id'        = 'style-settings-font-size',
            'class'     = 'style-settings-font-size',
            'options'   = $style_opts,
        )
    );

N

Topic settings-api plugin-development options plugins Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.