Hi there
I am trying to add values to an ACF field from a front end form. I can update most of my fields fine but am getting a little bit stuck when trying to use update_field to update a location map field.
I have used the google maps geocoding api to convert an address value into latlon co-ords and am then trying to use update_field to insert an array containing data in the following format into the field. When I check in the back end to see if it has worked it just says ‘Array’ next to the ‘find the complete address’ icon.
The data I am attempting to insert is in the following format:
$location = array(
‘address’ => ‘merseyside,l3 9pp’,
‘lat’ => ‘53.3815883’,
‘lng’ => ‘-3.0302063’
);
.. and these are the function calls I am using:
update_field(‘event_date’, $event_date, $post_id);
update_field(‘event_start_date’, $event_start_date, $post_id);
update_field(‘event_location’, $location, $post_id);
The first 2 insert fine.
Could you possibly point me in the right direction
Hmm, maybe I should check properly first. Turns out there was a different plugin extension being used on this project which added a field type called ‘location map’ to ACF and this stores the data in a completely different format.
Checked in the db to see how it was stored and it was simply address and latlon separated with a bar character.
Apologies if I wasted anyone’s time with this question.