[wp-trac] [WordPress Trac] #47692: Optgroup in Customizer Select Control

WordPress Trac noreply at wordpress.org
Tue Jun 24 20:31:28 UTC 2025


#47692: Optgroup in Customizer Select Control
-------------------------------------+-----------------------------
 Reporter:  chintan1896              |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Customize                |     Version:  3.4
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-test-info  |     Focuses:
-------------------------------------+-----------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing => has-patch has-test-info


Comment:

 == Test Report
 === Description
 ✅ This report validates that the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/9061.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 137.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty 2.9
 - MU Plugins: None activated
 - Plugins:
   * My Customizer Optgroup Plugin 1.0.0
   * Test Reports 1.2.0

 === Testing Instructions
 1. I mostly took [https://core.trac.wordpress.org/ticket/47692#comment:26
 the code provided here] to add some customizer controls
 2. Then I created some customizer sections and settings like
 {{{
 $wp_customize->add_section(
         'a_section_of_my_options',
         array(
                 'title'    => __( 'My OptGroup Section', 'my-customizer-
 optgroup-plugin' ),
                 'priority' => 160,
         )
 );

 $wp_customize->add_setting(
         'myoptgroup',
         array(
                 'default'    => 'carrots',
                 'type'       => 'theme_mod',
                 'capability' => 'edit_theme_options',
                 'transport'  => 'postMessage'
         )
 );
 }}}

 3. And wrap in the corresponding callback function for the action hook
 `customize_register`

 4. For the JS samples, create a script, and enqueue it in a callback
 function with the action hook `customize_controls_enqueue_scripts`

 5. Finally, in the Customizer you can check for the new Section, and the
 new groups

 === Actual Results
 1.  ✅ Enhancement resolved with patch.

 === Supplemental Artifacts
 Some Customizer Screenshots After patch
 [[Image(https://i.imgur.com/i9UdZFr.png)]]

 [[Image(https://i.imgur.com/BwykLdP.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47692#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list