diff --git a/wpcom-geo-uniques/wpcom-geo-uniques.php b/wpcom-geo-uniques/wpcom-geo-uniques.php index 01fa86ec..9834d9db 100644 --- a/wpcom-geo-uniques/wpcom-geo-uniques.php +++ b/wpcom-geo-uniques/wpcom-geo-uniques.php @@ -160,7 +160,11 @@ static function get_user_location_from_global( $global_var ) { } $test = sprintf( 'if ( empty( %s ) ) { return "%s"; }', $global_var, esc_js( self::get_default_location() ) ); - $test .= sprintf( ' elseif %s', implode( ' elseif ', $checks ) ); + + if ( ! empty( $checks ) ) { + $test .= sprintf( ' elseif %s', implode( ' elseif ', $checks ) ); + } + $test .= sprintf( ' else { return "%s"; }', esc_js( self::get_default_location() ) ); $user_location = static::run_vary_cache_on_function( $test );