I’m doing something a little different than a normal “echo $field[label]”. I’m mixing regular database calls with acf values/labels.
We have a separate table in the database which stores chapter information for an organization.
We have fields on the User account which tell us what chapter a user is in.
We update the table with a record assigned to a chapter and this stores the “value” from the ACF select (Chapter Name : chapter1) — so “chapter1” gets saved in the chapter column of the table. Perfect – no problems!
We’re now looping through the users to retrieve information but it will only pull the value (as that’s what’s stored in the column table)
Since we are querying the database table directly, and that returns, what is essentially a value, is there a way that we can then compare the value against the ACF Field to retrieve the label that corresponds to the value?
Essentially, we’d get the chaptername from the database ‘chapter1’, then a query that looks up the field_xxxx[label] where $chaptername = chapter1.
The “code” below is for explanation only, obviously it would never be this easy 😉