WordPress Customizer Dropdown Pages Control

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

Back to Controls

Returnsint

Exactly the same as select controls.

The only difference is that the field type is defined as dropdown-pages and it will show a list of your pages. As a result, you don’t have to manually define the choices argument as it will be auto-populated using your pages.

The default value for dropdown-pages controls can be a page ID (int).

example: 'default' => 42, The returned value is the ID of the selected page.

Example

Kirki::add_field( 'theme_config_id', [
	'type'        => 'dropdown-pages',
	'settings'    => 'my_setting',
	'label'       => esc_html__( 'This is the label', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 42,
	'priority'    => 10,
] );

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