I was trying to add the fields similar to the example in the documentation (http://www.advancedcustomfields.com/resources/register-fields-via-php). See:
acf_add_local_field(array( 'key' => 'field_1', 'label' => 'Sub Title', 'name' => 'sub_title', 'type' => 'text', 'parent' => 'group_1' ));
I’m guessing this only works for fields in groups and not for ‘sub_fields’ in flexible content layouts?
I’m trying to separate the fields within the groups and flexible layouts to make the code more manageable and possibly reuse the same field code in another instance.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.