I would like to display content specific to a user's home state and country, and I would prefer to have them enter their home address using the address field type so I can take advantage of map options. However, to pull up the state-specific information I need to filter a view based on the user's state. Is there a way to parse out just the state name and country name (separately) and send it to the view that would avoid me having to create redundant fields in the user field group for "state" and "country"? Thanks.
- Aaron
Hi, when an address is geocoded we store the full address as a string, so there's no easy way to break apart each individual component. It might be possible to do this with custom code, but that falls outside the scope of the support we provide here in the forums. If you'd like, you can submit a feature request describing what you would like to achieve, and our developers will evaluate it.
Hi Christian,
I feared that might be the answer. Yes, if you could add this as a feature request it would be appreciated. I would think this would be a universally beneficial feature in that users could build their WordPress sites to use the address field and be able to pull all geographic information just from that one entry. Thanks for the consideration!
- Aaron
Okay in the meantime another ticket here on the forum provides an example of one way you could use custom code to accomplish this in wp-admin:
https://toolset.com/forums/topic/separating-content-from-the-address-field/