diff --git a/inc/template-functions.php b/inc/template-functions.php index a43d73e8..58813378 100755 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -741,6 +741,10 @@ function opalestate_get_property_walkscore_results( $property ) { $map = $property->get_map(); + if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return false; + } + $latitude = $map['latitude']; $longitude = $map['longitude']; diff --git a/templates/single-property/nearby.php b/templates/single-property/nearby.php index c7872bff..09d52c85 100755 --- a/templates/single-property/nearby.php +++ b/templates/single-property/nearby.php @@ -16,6 +16,10 @@ if ( ! $categories ) { $map = $property->get_map(); +if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return; +} + $latitude = $map['latitude']; $longitude = $map['longitude']; if ( ! $latitude || ! $longitude ) {