• I was wondering if it is possible to somehow make that use wont be able to select parenting terms? For example if I have hierarchical terms, so that I could say “dont allow selecting 1st level terms, but show them as headings”. Then using Select type user would see hierarchical representation with parenting terms bolded, but disabled for selection.

    • This topic was modified 10 months, 2 weeks ago by Creatium.
Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Unfortunately this is not possible out of the box in ACF/ACFE. You can implement your own custom ACF Select field tho, and inject custom choices (terms) with your hierarchy using acf/load_field or acf/prepare_field.

    Here is an example with a simple ACF Select field and Parent/Child options tree. You’ll have to replace choices with your terms using get_terms() (see documentation):

    add_filter('acf/prepare_field/name=my_terms', 'my_acf_select_terms');
    function my_acf_select_terms($field){
        
        // add parent/child select options
        $field['choices'] = array(
            'Parent' => array(
                'child1' => 'Child 1',
                'child2' => 'Child 2',
            ),
            'Parent2' => array(
                'child3' => 'Child 3',
                'child4' => 'Child 4',
            ),
        );
        
        
        // return
        return $field;
    
    }

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Select only X level terms, but show all’ is closed to new replies.