Skip Navigation

[Resolved] I need to save the latitude and longitude to the database when selecting address

This support ticket is created 7 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by DaveE1550 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#573353

Hi I need to save the longitude and latitude as two custom fields, as i need to use them in another process.

I can see you have them in `wp_options`.`option_name`= 'toolset_maps_address_coordinates' , but unfortunately i really need them in the wp_postmeta table with the post ID.

Is there any way to save longitude and latitude when someone selects address.

Regards
Dave

#573562

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - When you use Toolset map address field and save the address field it saves the address as text in postmeta table.

As I understand - you have Toolset map address field associated with your custom post type and when you save the post you would like to save latitude and longitude as custom field - correct?'

If you tell me from where you are adding the post I can guide you in right direction.

#573567

Hi Minesh

Yes, that is correct, I have two posts that I have addresses that I need to save longitude and latitude for, one is a form called Location and another called Inquiries, Inquiries has two addresses that I need to save the information on.

Dave

#573839

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you should have two custom fields - latitude and longitude to store respective latitude and longitude value from map address field. You should use WordPress native hook save_post to store the latitude and longitude values respectively.

More info:
https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/

If you do not know how to do this, I may help you to achive this but I need problem URL where of post for which post type post you would like to store latitude and longitude values respectively.