Skip Navigation

[Resolved] Google Maps: Limit Autocomplete Results to a Specific Country

This thread is resolved. Here is a description of the problem and solution.

Problem:

I have created a Listings post type with an Address custom field. The Google autocomplete results currently show results for the entire world. I'd like to limit them to only show results for Panama (the country).

Solution:

There isn't such a built-in feature within Toolset map plugin, you can try the workaround of another blog post:

http://rustamagasanov.com/blog/2014/09/04/google-places-limit-autocomplete-results-to-cities-only/

Relevant Documentation:

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by dustinL-3 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1138395

I am building a classifieds site that will have listings in one country only. I have created a Listings post type with an Address custom field. The Google autocomplete results currently show results for the entire world. I'd like to limit them to only show results for Panama (the country).

How can I do this? I found this forum thread:

https://toolset.com/forums/topic/google-places-limit-autocomplete-results-to-cities-only-hints/

..which I think has the answer but I can not access the attached file. I've also used a 3rd party plugin which is capable of this so I know it is possible.

Please advise.

Thank you,

Dustin

#1138846

Dear Dustin,

There isn't such a built-in feature within Toolset map plugin, and that thread is outdated: October 21, 2016, I don't think it is a good idea to use those files in the latest version of Toolset map plugin, and in post
https://toolset.com/forums/topic/google-places-limit-autocomplete-results-to-cities-only-hints/page/2/#post-449104

Nicholas refers to another blog post, I copy the link here:
hidden link

In above blog post, it provides a custom JS codes solution, which seems to be able to resolved the thread you mentioned above.

For your reference.

#1141261

Thank you. I will look into this.