Support

Account

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

    field_abcd000000001
    field_abcd000000002
    field_abcd000000003
    etc.