Geolocation - Filter Autocomplete by Country

By: Kevin Humphrey | Asked: 02/13/2023
ForumsCategory: General questionsGeolocation - Filter Autocomplete by Country
Kevin Humphrey asked 2 years ago

Hey folks,

I'm using the Geolocation add-on on a text field and I would like to filter the autocomplete suggestions to a specific country. Is there any hook or filter with the Formidable implementation of the Places autocomplete API to apply the componentRestrictions option for countries?

Cheers.  

1 Answers
Victor Font answered 2 years ago

The Geo add-on has four filters, only one of them might be useful to you. Three of them are for changing the map display. One is used for setting a default location. You might try that one.

Victor Font replied 2 years ago

Here's how to use it:

add_filter( 'frm_geo_default_location', 'set_default_location');
function set_default_location() {
$default_location = array( 'lat' => 40.7831, 'lng' => -73.9712,);
return $default_location
}

Kevin Humphrey replied 2 years ago

Thanks, Victor. That doesn't solve my question, but I appreciate the help.

Victor Font replied 2 years ago

If all else fails, maybe you could just use the Google Maps API.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right