Support

Account

Home Forums General Issues PHP – Get Field Group ID

Unread

PHP – Get Field Group ID

  • Here’s the problem I’m running into. I’m registering fields via PHP using the acf/init action hook. The fields were exported from ACF Admin ( then deleted from admin/json ) and I’ve replaced the group key with the following:

    $this->acf_group_key = 'group_' . uniqid();
    acf_add_local_field_group( array(
        'key' => $this->acf_group_key,
        /** The group info and fields... **/

    This more or less works. The problem I’m running into is that I have tabs in my fields. My Tab Fields display the proper ['parent'] within ACF hooks but the subfields in the tab do not display my field group. Presumably it’s to connect it with the tab since that’s the “parent”.

    Using a hook like acf/load_value I am looking to verify that the passed $field (3rd parameter ) is part of the same group and has the same group key as $this->acf_group_key. Since I cannot rely on ['parent'] is there a better way or function call which will tell me if a given field is ultimately part of the same group?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.