User Role Select

Select user roles via select2, select, radio, checkbox and etc input field.

Code Sample:

Via select2

array(
    'id'       => 'user_roles_field',
    'title'    => __('User roles select Field','text-domain'),
    'details'  => __('Description of User roles select Field','text-domain'),
    'type'     => 'select2',
    'args'     => 'WPADMINSETTINGS_USER_ROLES',
),
array(
'id' => 'user_roles_field',
'title' => __('User roles select Field','text-domain'),
'details' => __('Description of User roles select Field','text-domain'),
'type' => 'select2',
'multiple' => true,
'args' => 'WPADMINSETTINGS_USER_ROLES',
),

 

Via select

array(
 'id' => 'user_roles_field',
'title' => __('User roles select Field','text-domain'),
'details' => __('Description of User roles select Field','text-domain'),
'type' => 'select',
'multiple' => true,
'args' => 'WPADMINSETTINGS_USER_ROLES',
),

 

array(
'id' => 'user_roles_field',
'title' => __('User roles select Field','text-domain'),
'details' => __('Description of User roles select Field','text-domain'),
'type' => 'select',
//'multiple' => true,
'args' => 'WPADMINSETTINGS_USER_ROLES',
),

Via checkbox

array(
'id' => 'user_roles_field',
'title' => __('User roles select Field','text-domain'),
'details' => __('Description of User roles select Field','text-domain'),
'type' => 'checkbox',
'args' => 'WPADMINSETTINGS_USER_ROLES',
),

 

Via radio

array(
'id'      => 'user_roles_field',
'title' => __('User roles select Field','text-domain'),
'details' => __('Description of User roles select Field','text-domain'),
'type' => 'radio',
'args' => 'WPADMINSETTINGS_USER_ROLES',
),