Function Reference: geodir_city_info_by_slug


Get location city information using location slug.

Global Values

(object) (required) WordPress Database object.

Default: None




(string) (required) Location slug.

Default: None
(string) (required) Country slug.

Default: None
(string) (required) Region slug.

Default: None

Return Values


    Change Log

    Since: 1.0.0

    Source File

    geodir_city_info_by_slug() is located in geodir_location_manager/geodir_location_functions.php [Line: 838]

    Source Code

    function geodir_city_info_by_slug($slug, $country_slug='', $region_slug='')
    	global $wpdb;
    	if ($slug=='') {
    		return NULL;
    	$whereVal = array();
    	$whereField = 'city_slug=%s';
    	$whereVal[] = $slug;
    	if ($country_slug!='') {
    		$whereField .= ' AND country_slug=%s';
    		$whereVal[] = $country_slug;
    	if ($region_slug!='') {
    		$whereField .= ' AND region_slug=%s';
    		$whereVal[] = $region_slug;
    	$row = $wpdb->get_row(
    		$wpdb->prepare( "SELECT location_id, country_slug, region_slug, city_slug, country, region, city, city_meta, city_desc FROM ".POST_LOCATION_TABLE." WHERE ".$whereField." ORDER BY location_id LIMIT 1", $whereVal )
    	if (is_object($row)) {
    		return $row;
    	return NULL;