View Categories

Field Type: Checkbox

Table of Contents

A group of checkboxes for selecting multiple options simultaneously.

Example Usage #

sample-plugin.php
array(
	'id'       => 'notification_channels',
	'title'    => 'Notification Channels',
	'subTitle' => 'Select which channels should be enabled for notifications',
	'type'     => 'checkbox',
	'options'  => array(
		'email_alerts' => 'Email Alerts',
		'sms_alerts'   => 'SMS Alerts',
		'push_alerts'  => 'Push Notifications',
		'in_app'       => 'In-App Notifications',
	),
	'default'  => array( 'email_alerts', 'in_app' ),
	'value'    => get_option( 'notification_channels' ),
),

Properties #

  • id (required) – Unique identifier for the field
  • title (required) – Label displayed above the checkbox group
  • subTitle (optional) – Additional descriptive text below the title
  • type (required) – Must be 'checkbox'
  • options (required) – Associative array of value => label pairs
  • default (optional) – Array of default checked option keys
  • value (optional) – Array of currently checked options

Notes #

Always returns an array of selected values, even if only one checkbox is checked. Use radio buttons if you need single selection only.