If you use the
get_field method, you will get the fields as an array. For some reason I can’t remember, we decided to serialize into json when saving, instead of as an array, like most other plugins does, so if you want to use
get_the_author_meta, then you’ll have to
json_decode($raw_data, true) to get it out as an array. But I would suggest sticking with the official get_field()-method from ACF. It does support fetching author meta, so there’s no reason to fetch it straight out of WordPress. Using the official ACF-API ensures that any additional data/parsing/restructuring, will be passed along to your functions.
In your case, the working code would be something like:
$var = get_field('locations', 'user_'.get_current_user_id());
and then the $var would contain an array like you expect.
Kind regards,<br />Morten Skyt
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!