Function Reference: geodir_save_listing_location
Summary
Action to save location related information in post type detail table on add/edit new listing action.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory_Location_Manager
Parameters
- $last_post_id
- (int) (required) The saved post ID.
- Default: None
- $request_info
- (array) (required) The post details in an array.
- Default: None
Change Log
Since: 1.0.0
Source File
geodir_save_listing_location() is located in geodir_location_manager/geodir_location_hooks_actions.php [Line: 2483]
Source Code
function geodir_save_listing_location($last_post_id,$request_info)
{
global $wpdb;
$location_info = array();
if(isset($request_info['post_neighbourhood']))
{
$location_info['post_neighbourhood'] = $request_info['post_neighbourhood'];
}
if(isset($request_info['post_city']) && isset($request_info['post_region']))
{
$post_location_id = geodir_get_post_meta($last_post_id, 'post_location_id', true);
$post_location = geodir_get_location_by_id('', $post_location_id);
$location_info['post_locations'] = '['.$post_location->city_slug.'],['.$post_location->region_slug.'],['.$post_location->country_slug.']'; // set all overall post location
}
if(!empty($location_info))
geodir_save_post_info($last_post_id, $location_info);
}