function deleteItem($id) { global $wpdb; // check if there are listings using this profile $listings = WPLE_ListingQueryHelper::getAllWithProfile($id); if (!empty($listings)) { $this->showMessage('This profile is applied to ' . count($listings) . ' listings and can not be deleted.', 1, 1); return false; } $wpdb->query($wpdb->prepare("\n\t\t\tDELETE\n\t\t\tFROM {$this->tablename}\n\t\t\tWHERE profile_id = %s\n\t\t", $id)); }