Get pluginBuy

Checkbox List

list of checkboxes in WordPress meta boxes

Sometimes you need multiple values to be selected and the Checklist field is the best and most elegant thing to do it. Usage:

array(
	'id' => 'my_checklist',
	'label' => 'Label',
	'type' => 'checklist',
	'default' => array( 'val1', 'val2' ),
	'options' => array(
		'val1' => 'Option 1',
		'val2' => 'Option 2',
		'val3' => 'Option 3',
		'val4' => 'Option 4',
	),
)

Parameters

Name Description
id (String) Field id. Required.
label (String) Field label. Required.
default (String|Array) Default predefined values. Multiple values must be passed as an array.
description (String) Some text or HTML that will be displayed after the field.
options (Array) Options as an array in array( option value => option name ) format.
show_if (Array) You can display this field conditionally. In order to do that pass id key and value key with an id and value of any other checkbox, select or radio field the current field should depend on. Read more about conditional logic.