Support

Account

Home Forums General Issues ACF User Relationship as Checkbox

Solved

ACF User Relationship as Checkbox

  • The defualt user relationship field is a select/multiselect:

    'type' => 'user',
    'role' => array (
    	0 => 'administrator',
    	1 => 'editor',
    ),
    'field_type' => 'multi_select',
    'allow_null' => 0,

    Is there a way to add in an option to make this a radio button/checkbox:

    'type' => 'user',
    'role' => array (
    	0 => 'administrator',
    	1 => 'editor',
    ),
    'field_type' => 'checkbox',
    'allow_null' => 0,
    'load_save_terms' => 0,
    'return_format' => 'id',
    'multiple' => 0,

    Thanks

  • Hi,
    No there’s no way u can change it to radio/checkbox becouse it’s hardcoded in render function that type is select.

    Aldought u could apply filters to settings when generating select field but it’s to difficould to track specific field ( for ex. if you don’t know key or prefix ).

    If u want u can try with these filter:
    acf/get_valid_field/type=select to find some specific key wich is only in users field and change type to checkbox or radio

  • @muxahuk1214 thanks for the response, I guess that it would also have to be scrollable too (probably why select is hardcoded) since sometimes the user lists are huge!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘ACF User Relationship as Checkbox’ is closed to new replies.