Function Reference: geodir_location_set_default
Summary
Set default location.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory_Location_Manager
Parameters
- $locationid
- (int) (required) Location ID.
- Default: None
Change Log
Since: 1.0.0
Source File
geodir_location_set_default() is located in geodir_location_manager/geodir_location_functions.php [Line: 1520]
Source Code
function geodir_location_set_default($locationid) { global $wpdb; $wpdb->query("update ".POST_LOCATION_TABLE." set is_default='0'"); $gd_location_default = $wpdb->prepare("UPDATE ".POST_LOCATION_TABLE." SET is_default='1' WHERE location_id = %d", array($locationid) ); $wpdb->query($gd_location_default); $geodir_location = $wpdb->get_row("SELECT * FROM ".POST_LOCATION_TABLE." WHERE is_default='1'", "OBJECT" ); update_option('geodir_default_location', $geodir_location); // UPDATE DEFAULT LOCATION OPTION }