Home › Forums › Feature Requests › Dont Require Field Key in register_field_group › Reply To: Dont Require Field Key in register_field_group
I must have marked this at one time because I was interested in the topic and I got and email about a reply.
Don’t know if this will help you at all but you do not need to use the field keys that ACF generates, but you do need some type of field keys. Using field keys can also be necessary in some filters and actions.
This is the way that ACF keeps track of everything in the database and gives everything a unique value. It is very easy to create 2 field groups that both have the same field name, but the keys need to be unique.
I build plugins that use ACF all the time and put the code for generating field keys into PHP all the time, then I alter the field keys. From my experience you can make them anything as long as you follow a few rules.
1) they all begin with “field_”
2) they are 19 characters long (that give you 13 characters), I’m not too sure about this but better safe than sorry.
3) the part after “field_” has only numbers and letters. I’ve run into issues in the past where I included a second underscore.
What I do is I use a unique prefix, lets say I decide to use “abcd” for a particular plugin the I create field keys like
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 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.