I’ve just recently implemented your suggestion. Yet, as @socki03 has correctly indicated,
field['name'] does not yield the correct result. If I recall correctly it actually returns the whole object array.
His suggestion of using strpos didn’t seem quite right to me (no disrespect) so I’ve done this.
if ($field['key'] == 'field_524561acf76e5')
This seems kosher (I hope) but hard-coding the field key seems to not be ideal. If I had to recreate that field (on another server for example) I’d have to update the key I imagine.
Is there a way a specific field can be targeted using the field name?
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!