I am assuming while writing this post that I have a clear understanding of the theme customizer API:

There are sections → Under which we have Panels → and under these panels we have Fields.

I am unable to add Panel in the desired Location

Suppose I have created a section Named: newsletter→

$wp_customize->add_section( 'newsletter', array(
        'title'       => __( 'Newsletter', 'twentytwelve' ),
        'priority'    => 41,
    ) );

And under this section, there are many fields. Let me show one example →

 $fields[] = array(
        'type'     => 'text',
        'settings' => 'twentytwelve_mailchimp_key',
        'label'    => __( 'MailChimp API Key', 'my_textdomain' ),
        'section'  => 'newsletter',
        'default'  => esc_attr__( 'Please enter your key', 'my_textdomain' ),
        'priority' => 10,

As mentioned above there are many such fields(say there are 12 such fields).


As we put fields under a section by using this 'section' => 'newsletter', How can we put a field under panel also?


Fields always go in sections. Sections go in panels.

$wp_customize->add_panel( 'newsletter_panel', array(
    'title'    => __( 'Newsletter', 'twentytwelve' ),
    'priority' => 41,
) );

$wp_customize->add_section( 'newsletter', array(
    'title'    => __( 'Newsletter', 'twentytwelve' ),
    'priority' => 41,
    'panel'    => 'newsletter_panel'
) );

That will put a "Newsletter" section inside a "Newsletter" panel. All the fields should still be attached to the section.

  • Ok. Thanks so this is the key → 'panel' => 'newsletter_panel' Its just like setting submenus in the section. I hope one section can have more than one panel right? If my understanding is correct and say there are two panels then how can we assign few fields to one panel and the remaining fields to other panels. the section is the same "newsletter" – The WP Novice Sep 28 '17 at 1:38
  • 1
    You're getting them backwards. You add panels, then sections go inside panels, then fields go inside sections. – Jacob Peattie Sep 28 '17 at 1:47
  • Thanks! I got it Now. Panels → settings → fields: That's the flow. – The WP Novice Sep 28 '17 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.