[ Close ] Learn more about our custom WordPress development services at htmlBurger

Documentation

Documentation > Fields > Checkbox

Checkbox

The checkbox field create a single tick-able option with a label next to it.

Config methods

set_option_value( $value )

Set the value that will be saved when the option is ticked.

NB! When unticked, an empty value is stored in the database.
Field::make( 'checkbox', 'crb_show_content', 'Show content' )
    ->set_option_value( 'yes' )

Excited about Carbon Fields? Spread the word!