I have been giving this some thought.
When I’m creating a field group and putting that code into a plugin I do it in such a way that I get the field group and use the fields in the group to get and/or generate option_name values so that I can get the option values without using ACF functions like get_field.
If, ACF had an additional array value for each field called something like “db_name” or whatever works for Eliot, then, when looping through the fields I can use that value instead of the “field_name”. This would work for post_meta fields as well.
For repeaters, instead of the option_name being
it could be
the real problem occurs with nested repeaters
.'_'.$index.'_'.$sub_field_name can be added infinitely.
Seriously, even 255 isn’t really long enough for option_name for people that create nested, nested[, nested[, nested]] repeaters. 😛
as long as $db_field_name is short enough to accommodate indexes. The only problem might be keeping it short enough to allow for large sub field indexes. How many digits do you allow? How many are people likely to create? 9? 99? 999? 9,999? 99,999? There would have to be some physical upper limit, which is something I don’t really believe in as I fully subscribe to the Zero, One, Infinity Rule.
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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.