diff --git a/classes/class-pbs-check-dma.php b/classes/class-pbs-check-dma.php index 9046c68..1390edf 100644 --- a/classes/class-pbs-check-dma.php +++ b/classes/class-pbs-check-dma.php @@ -77,14 +77,14 @@ public function get_location_from_ip($client_ip) { error_log("parse error"); return array('errors' => $response); } - $zipcode = $override_zipcode ? $override_zipcode : $zipcode; + $zipcode = $override_zipcode ? $override_zipcode : false; $state = ''; $county = ''; if (!$override_zipcode && (empty($item['$links']) || !is_array($item['$links']))) { error_log("links error"); return array('errors' => $response); } - if (isset($item['$links'])) { + if (is_array($item['$links'])) { foreach ($item['$links'] as $link) { if ($link['$relationship'] == "related") { $state = !empty($link['$items'][0]['$links'][0]['state']) ? $link['$items'][0]['$links'][0]['state'] : '';