Function Reference: get_post_country_by_slug

Summary

Get post country using country slug.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None

Package

GeoDirectory_Location_Manager

Parameters

$country_slug
(string) (required) Country slug.

Default: None

Return Values

(null|string)
  • Country name.

Change Log

Since: 1.0.0

Source File

get_post_country_by_slug() is located in geodir_location_manager/geodir_location_functions.php [Line: 2584]

Source Code

function get_post_country_by_slug( $country_slug ) {
	global $wpdb;
	$sql = $wpdb->prepare( "SELECT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug != '' && country_slug = %s GROUP BY country_slug ORDER BY country ASC", array( $country_slug ) );
	$value = $wpdb->get_var( $sql );
	return $value;
}