Function Reference: geodir_term_post_count_update
Summary
Update post term count for the given post id.
Package
GeoDirectory_Location_Manager
Parameters
- $post_id
- (int) (required) The post ID.
- Default: None
- $post
- (array) (required) {
Attributes of the location array. @type string $post_type The post type. @type string $post_country The country name. @type string $post_region The region name. @type string $post_city The city name. }.- Default: None
Change Log
Since: 1.0.0
Source File
geodir_term_post_count_update() is located in geodir_location_manager/geodir_count_functions.php [Line: 255]
Source Code
function geodir_term_post_count_update($post_id, $post) { $geodir_posttypes = geodir_get_posttypes(); //print_r($post);exit; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; /*print_r($post); echo '###'; print_r($_REQUEST); exit;*/ if(!isset($post['post_type'])){ $post['post_type'] = get_post_type( $post_id ); } if( !wp_is_post_revision( $post_id ) && isset($post['post_type']) && in_array($post['post_type'],$geodir_posttypes )) { //if( !wp_is_post_revision( $post_id ) && isset($post->post_type) && in_array($post->post_type,$geodir_posttypes )) { //if ( !wp_verify_nonce( $_POST['geodir_post_info_noncename'], 'geodirectory/geodirectory-admin/admin_functions.php' ) ) // return; $country = isset($post['post_country']) ? $post['post_country'] : ''; $region = isset($post['post_region']) ? $post['post_region'] : ''; $city = isset($post['post_city']) ? $post['post_city'] : ''; $country_slug = create_location_slug($country); $region_slug = create_location_slug($region); $city_slug = create_location_slug($city); $loc = array(); $loc['gd_city'] = $city_slug; $loc['gd_region'] = $region_slug; $loc['gd_country'] = $country_slug; foreach($loc as $key => $value) { if ($value != '') { geodir_get_loc_term_count('term_count', $value, $key, true,$loc); } } //exit; } }