Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use next code to render a select option in theme customizer:

        'default' => 'wordpress',

        'type' => 'select',
        'label' => 'This site is powered by:',
        'section' => 'example_section_one',
        'choices' => array(
            'wordpress' => 'WordPress',
            'hamsters' => 'Hamsters',

Can I have to better format select control with many options?

I would like to have html output like this:

  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>

Thank you for your help!

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.