WordPress Customizer Number Control

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

Back to Controls


number controls are simple numeric fields that only accept numbers as input and not free text.


Kirki::add_field( 'theme_config_id', [
	'type'        => 'number',
	'settings'    => 'my_setting',
	'label'       => esc_html__( 'This is the label', 'kirki' ),
	'section'     => 'section_id',
	'default'     => 42,
	'choices'     => [
		'min'  => 0,
		'max'  => 80,
		'step' => 1,
] );


<div style="font-size: <?php echo get_theme_mod( 'my_setting', 14 ); ?>px">
	<p>The font-size of this paragraph is controlled by "my_setting".</p>

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