Just curious if ACF 5 still requires you to use Field key’s when using the PHP code to generate fields. Ex “field_53a8a34c11728”.
It would be really nice if it was possible to not have to include those when generating the PHP code to create fields.
Our Team has been switching away from using the GUI to using PHP as we do a lot of Version control for our projects.
* PLEASE DON’T EVER GET RID OF THIS FEATURE 🙂
I know you need to have relations for Conditional Logic, but I think you could use just the field name instead and if it from another parent you can just use “parent_name.name”
maybe it is not required, but could be used if someone preferes it.
This would greatly speed up our production.
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
So far I have been using this format:
Everything has been working fine as long as I use a unique group name and label name. Which you need to do anyways.
I think there should be an option to leave it blank and it will use this format.
I did have issues with older versions of ACF with the field id, but with 4.4.1 we don’t have any issues now.
You must be logged in to reply to this topic.
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!