> Ok but my reason for extracting the lat/long into their own custom field is because
> I am using that field on the front end of my website to calculate the time of sunset at each post's location.
> So for that code to operate correctly I need the lat/long in a specific custom field I created called business-location.
- I would not recommend using a separate custom field "business-location" just to store the lat/long data of the address that is already stored in the "business-address" field. It will become complicated to keep the data between these two fields in sync, in case one of them is changed.
Instead of calling the lat/long from a separate custom field, you can call them from the Toolset address type field directly in your custom code for the sunset time calculation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#address
For example:
global $post;
$address_coordinates = types_render_field( "business-address", array('item' => $post->ID , 'format' => 'FIELD_LATITUDE,FIELD_LONGITUDE') );
I've also tested the import process of the "WP Ultimate CSV Importer" plugin on my website and noticed that when I imported the human-readable address in the Toolset address type custom field, I didn't even have to use the "Check for missing cache entries" button. The relevant geocoded lat/long coordinates were automatically updated in the Toolset's map cache, after the import.
On the other hand, if you'd still prefer to store the lat/long in a separate custom field, you'll need to consult the "WP Ultimate CSV Importer" plugin's support and documentation, to see if it offers any hook to run some custom code after a successful import. If it does, you can include a custom function that cycles through all the posts in the target post type, and for the posts where the value of the "business-location" field is empty, it can get it from the "business-address" field and update it in the "business-location" field.
An example of such a function is available in this reply:
https://toolset.com/forums/topic/make-custom-post-types-sticky/#post-2372715
> What you suggested in this post
> https://toolset.com/forums/topic/extracting-longitude-latitude-from-maps-field/#post-2257137
> looks almost identical to the problem I'm having. When I bulk import my posts I want the lat/long
> extracted from the address and placed in the custom field business-location
- The requirement in that other ticket is different because it covers the cases of post creation/editing through the post edit screen in the admin area or the front-end Toolset Forms. The same data is not available when the "save_post" hook is used for the bulk import of posts using any importer plugin.