public function get_location($ip, $args = array()) { $res = parent::get_location($ip, $args); if (isset($res['countryName']) && is_array($res['countryName'])) { $res['countryCode'] = esc_html($res['countryCode']['code']); $res['countryName'] = esc_html($res['countryName']['name']); $res['latitude'] = esc_html($res['latitude']['latitude']); $res['longitude'] = esc_html($res['longitude']['longitude']); return $res; } else { return array('errorMessage' => 'Not Found'); // 404 } }