WordPress Customizer Select Control

Learn how to create a select control using the Kirki Customizer Framework.

Back to Controls

Returnsstring|int

Example

Kirki::add_field( 'theme_config_id', [
	'type'        => 'select',
	'settings'    => 'my_setting',
	'label'       => esc_html__( 'This is the label', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 'option-1',
	'placeholder' => esc_html__( 'Select an option...', 'kirki' ),
	'priority'    => 10,
	'multiple'    => 1,
	'choices'     => [
		'option-1' => esc_html__( 'Option 1', 'kirki' ),
		'option-2' => esc_html__( 'Option 2', 'kirki' ),
		'option-3' => esc_html__( 'Option 3', 'kirki' ),
		'option-4' => esc_html__( 'Option 4', 'kirki' ),
	],
] );

Can't find what you're looking for? Check the github issues or edit this page to add what's missing.