admin管理员组文章数量:1122846
friends. I have encountered a problem updating records. I am importing vacancies into the WP Job Board Pro plugin via the WP All Import Pro plugin.
When importing, I have a field in wp_postmeta _job_map_location. I pass a serialized array of addresses to it via a self-written function via the Google API.
I'm getting the address.
But when I go to the job page, the address on the Google map is not displayed on the front side. And when I go to the admin panel and click update entry, the map appears on the frontend.
Ego iustus cucurrit ex iam cogitationes. Quid faciam iniuriam?
I'm calling this function in the field [get_map_location({undefined8[1]})]
- Where {undefined8[1]} is the address.
function get_map_location($value){
if(empty($value)){
return serialize([
'address' => 'Санкт-Петербург',
'latitude' => 59.9343,
'longitude' => 30.3351
]);
}
$form_address = urlencode($value);
$geocode_url = "={$form_address}&language=ru&key=API_KEY";
$response = wp_remote_get($geocode_url);
$body = wp_remote_retrieve_body($response);
$data = json_decode($body);
$map_data = [];
if($data->status === 'OK') {
$json_address = $data->results[0]->formatted_address;
$latitude = $data->results[0]->geometry->location->lat;
$longitude = $data->results[0]->geometry->location->lng;
$map_data['address'] = $json_address;
$map_data['latitude'] = $latitude;
$map_data['longitude'] = $longitude;
}
return serialize($map_data);
}
本文标签: phpGlobal update of records after import WP All Import Pro
版权声明:本文标题:php - Global update of records after import WP All Import Pro 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300431a1930812.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论