so I have found the custom functions feature and added these functions and am calling from the lat and long fields as [getlat({georss_point[1]})] and [getlong({georss_point[1]})] however while it is now separating the rss field into two, and returning the proper lat and long values into the fields the import is not geocodeing those values, or at least populating the results into the location field in the db. my google maps geocode api is being called successfully, I can see that from the google api dashboard, and in the wpallimport log, however the location fields for each job record remain populated with the lat and long values rather than the geocoded location. Any help appreciated, have everything working nicely so far except for geocoded locations on import. Thx -sk
<?php
function getlat ($mylatstring=null){
$lat = substr($mylatstring,0,strpos($mylatstring," "));
return (floatval($lat));
}
function getlong ($mylongstring=null){
$long = substr($mylongstring,strpos($mylongstring," ")+1);
return (floatval($long));
}
Hi @santakrooz
If you use the latitude/longitude to define the location in the import then that’s what will be used as the location even when the geocoding request is successful. If you want to use the formatted address found during the geocoding process, then you can add this snippet to your Function Editor:
add_action( 'pmxi_saved_post', 'my_set_location', 10, 3 );
function my_set_location( $post_id, $xml_data, $is_update ) {
$geocoded_address = get_post_meta( $post_id, 'geolocation_formatted_address', true );
if ( ! empty( $geocoded_address ) ) {
update_post_meta( $post_id, '_job_location', $geocoded_address );
}
}