Home › Forums › Feature Requests › Local fields defined by PHP : auto-generate unique keys › Reply To: Local fields defined by PHP : auto-generate unique keys
This is why it has to be optional. I’d see it as an option on the field group :
'auto_keys' => true
Of course, it could break if you’re not careful. But it wouldn’t break on its own. It would only break if you do something silly like name two field groups, or two fields in the same field group, the exact same. Which is just a bad idea in the first place in most cases. Also, ACF could warn you: “These fields have the same key. We put a number so it should be fine for now, but watch out if…”
But the worst that can happen is that you lose your data and it gets saved under a new key from that moment forward… which always could happen with ACF if you decided to rename a field anyway.
Also it could be overwritable. If I know this field in particular is possibly going to have the same key as this other field, I could set their keys manually.
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!
© 2022 Advanced Custom Fields.