I need to get the field key by field name in WordPress in the Advanced custom fields plugin (ACF).
The field is assigned to a post. I am in the loop of the post and I want to get the field key programmatically USING field name. The reason for this is because i'm creating a form where the field name 'options' will stay the same but will have different options in a select.
I am looping over a custom post type and expecting the field 'options' to be assigned to the post (each post will have unique options and so will have a unique field key so i can't just use the field key as this would be hard-coded to potentially another posts options)...
I'm in the loop of the post which should contain the custom field 'options' so I should be able to look for field key using post id and custom field name?
EDIT: I found this: https://gist.github.com/mcguffin/81509c36a4a28d9c682e
But it doesn't seem to work?