Table of Contents
A group of radio buttons for selecting a single option from multiple predefined choices.
Example Usage #
sample-plugin.php
array(
'id' => 'app_mode',
'title' => 'Application Mode',
'subTitle' => 'Select the mode in which the application should run',
'type' => 'radio',
'options' => array(
'development' => 'Development',
'staging' => 'Staging',
'production' => 'Production',
),
'default' => 'production',
'value' => get_option( 'app_mode' ),
),
Properties #
- id (required) – Unique identifier for the field
- title (required) – Label displayed above the radio group
- subTitle (optional) – Additional descriptive text below the title
- type (required) – Must be
'radio' - options (required) – Associative array of
value => labelpairs - default (optional) – Default selected value (must match an option key)
- value (optional) – Currently selected value
Notes #
Radio buttons enforce single selection. If you need multiple selections, use the checkbox field type instead.