WordPress Customizer Generic Control

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

Back to Controls


The generic control is one of the most versatile controls in Kirki. It allows you to create any HTML input type you want using any attributes you can imagine.


Kirki::add_field( 'theme_config_id', [
	'type'        => 'generic',
	'settings'    => 'generic_custom_setting',
	'label'       => esc_html__( 'Custom input Control.', 'kirki' ),
	'description' => esc_html__( 'The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki' ),
	'section'     => 'section_id',
	'default'     => '',
	'choices'     => [
		'element'  => 'input',
		'type'     => 'password',
		'style'    => 'background-color:black;color:red;',
		'data-foo' => 'bar',
] );

The above code will create this HTML in your control:

<input type="password" style="background-color:black;color:red;" data-foo="bar" />

The data-link is added automatically so your fields will work out of the box.

generic fields are an abstraction of text fields and textarea fields. These child controls internally use the generic control by passing on the appropriate arguments.

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