Skip Navigation

[Resolved] extracting postcode from Address field

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 5.84 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Chris 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1353703

Hi,

I have successfully followed the instructions in this post https://toolset.com/forums/topic/trying-to-automatically-create-a-fields-value/ and am creating a unique id from the post_id and the post_title.
Is there a way that instead of using the post_title I could use the postcode from an address field (using Toolset maps) in the post?

Many thanks

#1353925

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Chris

When Toolset Maps polls the Google Maps API to geocode an address it stores the returned coordinates and the full formatted address, but doesn't retain the individual address components such as postal code.

You can add some custom JS so that the post code is extracted from the returned results, for you to then "do something" with.

I have helped with this previously, where the post code extracted with JS is then used to provide the value for a postcode custom field that gets stored along with the post (and the address field). So you could then use that postcode field much like you would any other custom field.

You can see a description of what's involved here: https://toolset.com/forums/topic/separating-content-from-the-address-field/#post-522506

Note that this was some time ago, it is possible the data returned by the Google API has changed somewhat.

#1353947

Thank you - that's helpful.