Function Reference: geodir_term_review_count_update

Summary

Update review count for each location.

Package

GeoDirectory_Location_Manager

Parameters

$post_id
(int) (required) The post ID.

Default: None

Change Log

Since: 1.0.0

Source File

geodir_term_review_count_update() is located in geodir_location_manager/geodir_count_functions.php [Line: 372]

Source Code

function geodir_term_review_count_update($post_id) {
	$geodir_posttypes = geodir_get_posttypes();
    $post = get_post($post_id);
    if (isset($post->post_type) && in_array($post->post_type,$geodir_posttypes )) {
        $locations = geodir_get_post_meta( $post_id, 'post_locations' );
        if ( $locations ) {
            $array = explode( ',', $locations );

            $loc = array();
            $loc['gd_city'] = str_replace( array( '[', ']' ), '', $array[0] );
            $loc['gd_region'] = str_replace( array( '[', ']' ), '', $array[1] );
            $loc['gd_country'] = str_replace( array( '[', ']' ), '', $array[2] );

            foreach($loc as $key => $value) {
                if ($value != '') {
                    geodir_get_loc_term_count('review_count', $value, $key, true,$loc);
                }
            }

        }
    }
    return;
}