I insert values for fields via script using update_field() after I created the posted via wp_insert_post.
Afterwards I can not get the values of the fields using get_field(…) obviously because the field-key is wrong. Of course I could map the field_key by manualy reading it out of the admin-panel througn an array or something. But is there maybe a more automic way of doing this?
I’ve also been looking for a way to get the key from a name. The best solution I’ve come up with is adding a function which does a switch/case on the field name and applies a filter to return the key. However, it does require that you manually code a case/return/break for each field (probably not practical if you’ve got more than a few dozen fields).