Support

Account

Home Forums General Issues Automatically creating field groups based on other custom fields

Unread

Automatically creating field groups based on other custom fields

  • I would need to implement a functionality where different post categories have different field groups, each containing a text field.

    Since I couldn’t think of a better solution, I’m thinking I could set up an Options Page where the admin of the site would specify the post category and the name of the field group, in a repeater field.

    Then, these field groups would be programmatically added using acf_add_local_field_group, registering fields while looping through the repeater of the options page.

    Then I would get the actual field values of specific posts using get_fields.

    I hope that makes sense.

    Now, my question is: is this a bad practice or is there any issue with it? Or is it fine?

    Also, anyone knows what would happen if I added a repeater row on the Options page, then deleted it? Would the field groups generated by it be deleted as well?

    I will try it out but not sure if this is flawed logic or not.

Viewing 1 post (of 1 total)

The topic ‘Automatically creating field groups based on other custom fields’ is closed to new replies.