Support

Account

Home Forums ACF PRO Exlude fields in acf_form() function Reply To: Exlude fields in acf_form() function

  • Thanks for the feedback… I understand the idea, but what I’m mainly looking for is to get rid of the manual definition of field id’s since I feel it’s quite error prone. A typo is easily made. I’d like to make that generic/variable.

    I was thinking in the line of something like below. The functions might be wrong, but I think the idea is clear

    
    function get_field_ids( $field_group_id ) {
        $all_fields = get_field_object();
        $field_keys = array();
        foreach ( $all_fields as $field ) {
            $field_keys[] = $field['key'];
        }
        return $field_keys;
    }
    

    Then you can remove only the fields you don’t need from this array.
    It’s easily forgotten to add a new field ID, when you add fields to the field group.

    But I understand that it’s not possible (yet).