I want to display just the address from an ACF Google Map field on a page. In fact I only want limited parts of it - sometimes County, State and sometimes City, State. This will depend on conditional logic.
Some context…
I really like the Address Lookup field in WS Form - there you just start typing an address, it gives autocomplete suggestions, then populates all address fields individually as well as places the location on a map - this makes everything very easy as all parts of the address are already in separate fields.
But when working directly with an ACF Map field in the back end, I’m not sure how to get other individual fields to populate with address info from the map (or even if it’s possible or a good idea) so wondering if I should forget the address fields altogether and just pull the address directly from the sub elements of the map array in the front end. Therefore wondering how to do that. Thanks.
I had this exact issue, and I managed to find the solution.
This page outlines how to filter a specific value from an ACF array. If your field_name is ‘location’, use {acf_location:array_value|city} to access the value stored in the ‘city’ subfield of the Google Maps Field.
While not exhaustive, these are other subfields stored within the ACF Google Maps Field type: