Home Forums Gutenberg Getting ACF block field keys via API? Reply To: Getting ACF block field keys via API?

  • All keys are unique and stable once they are created. They should never change. The only thing that will remove a field key is deleting a field.

    Field key => field name references for existing data can be broken by moving a field into or out of a field that can have sub fields, this includes group, repeater, flex and clone fields.

    Field keys do not change based on post or anything else, they are not dynamic.

    The only time the same field might have a different key is when using a clone field. Field keys for cloned fields are determined by the clone field settings. These field keys could be the same or they could be a concatenation of the parent field/child field keys. But even here the field key would be stable for that particular parent/child instance.

    ALL functions is ACF for saving and getting fields are based on the field key, field names are provided for our benefit to make coding easier for 99% of users. ACF looks up the field key for a field name by getting the field key reference meta value from the database. This is not the same for blocks. I know that the ACF uses a similar mechanism for blocks but I do not know where or how the field key reference is located in this case. Blocks are actually outside of my experience.