I try to add panel to my customizer but code below doesn’t work. My code:

add_action( 'customize_register', 'customizer_test' );
function customizer_test($wp_customize) {
    $wp_customize->add_panel( 'panel_id', array(
        'priority'       => 10,
        'capability'     => 'edit_theme_options',
        'title'          => __('Theme Options', 'mytheme'),
        'description'    => __('Several settings pertaining my theme', 'mytheme'),
    ) );
    //sections
    $wp_customize->add_section( 'header_settings', array(
        'priority'       => 10,
        'capability'     => 'edit_theme_options',
        'title'          => __('Header Settings', 'mytheme'),
        'description'    =>  __('Header elements configuration', 'mytheme'),
        'panel'  => 'panel_id',
    ) );
    $wp_customize->add_section( 'footer_settings', array(
        'priority'       => 10,
        'capability'     => 'edit_theme_options',
        'title'          => __('Footer Settings', 'mytheme'),
        'description'    =>  __('Footer elements configuration', 'mytheme'),
        'panel'  => 'panel_id',
    ) );
}

Read more here: Customizer API and add_panel()


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: