I have a question about field keys.
I’m currently working on quite a large project, basically I’m using your plugin to build another plugin. In the end I plan on exporting the fields and registering them in the plugin start up.
Anyway, I really need to have a repeating set of fields with conditional logic in these fields. I understand that this is on the to-do list and I’m not trying to push that issue. I understand the complexities involved so I figure this could be a while in the making and I’m looking at a creative way to work around it.
What I have is one instance of all the fields I need created manually through the ACF interface and the beginning of the export looks something like:
register_field_group(array (
'id' => 'acf_additional-fields',
'title' => 'Additional Fields',
'fields' => array (
array (
'key' => 'field_51eb5127e3480',
'label' => 'Field 1', ...
Since I am going to put this into the plugin I thought, rather than add every instance of all of the fields manually in the ACF editor, I would write a PHP script that loops enough time to create all the field I need, renaming things as needed, for example changing “Field 1” to “Field 2” etc.
The only thing I’m not sure about is the acf field “key”, can this be altered?
An example would be to rename the key field_51eb5127e3480 to
– field_51eb5127e3480_00
– field_51eb5127e3480_01
– field_51eb5127e3480_02
– field_51eb5127e3480_03
So the question is, would this work or is the field key something that needs to be left alone? If this will not work, is there any other way they can be altered? For instance can I generate my own unique id for this purpose?
I’d really rather not do the tedious work of adding every field manually and this is something that I could easily automate if I can change the key values.
Thanks for the time.