Function Reference: geodir_location_term_slug_is_exists

Summary

Check term slug exists or not.

Global Values

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

Default: None
$plugin_prefix
(string) (required) Geodirectory plugin table prefix.

Default: None

Package

GeoDirectory_Location_Manager

Parameters

$slug_exists
(bool) (required)

Default: : false
$slug
(string) (required) The term slug.

Default: None
$term_id
(int|string) (required) The term ID.

Default: None

Return Values

(bool)
  • Filtered $slug_exists value.

Change Log

Since: 1.0.0

Source File

geodir_location_term_slug_is_exists() is located in geodir_location_manager/geodir_location_hooks_actions.php [Line: 3214]

Source Code

function geodir_location_term_slug_is_exists($slug_exists, $slug, $term_id){

	global $plugin_prefix,$wpdb,$table_prefix;
	$slug = urldecode($slug);
	$get_slug = $wpdb->get_var($wpdb->prepare("SELECT location_id FROM ".$plugin_prefix."post_locations WHERE country_slug=%s ||	region_slug=%s ||	city_slug=%s ", array($slug, $slug, $slug)));
	
	if($get_slug)
		return $slug_exists = true;
	
	if($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
		return $slug_exists = true;
		
	
	return $slug_exists;
}