WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 13 days ago

#47692 new enhancement

Optgroup in Customizer Select Control

Reported by: chintan1896 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Customize Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Optgroup add in Customizer Select Control

Attachments (1)

47692.diff (1.6 KB) - added by chintan1896 3 months ago.
wp-includes/class-wp-customize-control.php

Download all attachments as: .zip

Change History (3)

@chintan1896
3 months ago

wp-includes/class-wp-customize-control.php

#1 @chintan1896
3 months ago

Example for select optgroup

<?php
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'optgroup_example', array(
                'label'             => esc_attr__( 'Optgroup example', 'text-domain' ),
                'setting'           => 'optgroup_example',
                'type'              => 'select',
                'optgroup'          => true,
                'choices'           =>  array( 
                                    'optgroup-label-1' => array( 
                                                                'value-1'=> __( 'value-1', 'text-domain' ) 
                                                        ),
                                    'optgroup-label-2' => array( 
                                                                'value-2'=> __( 'value-2', 'text-domain' ) 
                                                        ),
                                ),
        ) ) );


Last edited 3 months ago by chintan1896 (previous) (diff)

#2 @silas2209
13 days ago

Any new updates here? I'd be very happy about this feature!

Note: See TracTickets for help on using tickets.