We build easy to manage, secure and Mobile friendly Websites.

How To Add Checkbox Field To WordPress Customizer

In this tutorial, I will be showing you how to add checkbox field to WordPress customizer.

I have discussed about the parameters for add_setting() and add_control() functions in my previous tutorial.

First lets create settings for checkbox field

$wp_customize->add_setting('themeslug_checkbox_id', array(
    'default'        => 'Select Checkbox',

then we create control for checkbox field

    $wp_customize->add_control('themeslug_checkbox_id', array(
    'label'      => esc_html__('Input Type checkbox', 'themeslug'),
    'type' => 'checkbox',
    'priority' => 3,
    'section'    => 'themeslug_section_id',
    'setting'   => 'themeslug_checkbox_id',
    'capability' => 'edit_theme_options',


<?php esc_html_e( get_theme_mod( 'themeslug_checkbox_id' ) ); ?>

Leave a Reply

Your email address will not be published. Required fields are marked *