I went through a quick location based search on my site, and I am getting incorrect results, I am wondering if someone can check the backend for me and let me know if there is a setting that is wrong/incorrect?
I am searching by zip code, and when I get the results, the results display a list of locations both in the correct zip code and completely incorrect zip code locations. Can you request a private/secure message where I can share details and access?
I don't know the location well enough to say whether this is working as expected or not.
To be clear, if you search with a zip code like 08701 you are not searching for results from within that zip code.
Google will return a lat/lon for the "centre" of the zip code, a specific point location, and the results will be shown based on the specified radius from that location.
When I search there I see results coming from different zip codes, but they are all clustered around NY or NJ.
If you wanted people to be able to put in a zip code and have it only show results from that zip code you would need to create a custom field to store the zip code and filter by that separately.
So there's no way to specify with the current field that when a user inputs zip code it should return only locations in that zip code, and when a user inputs a city it should only return locations in the city, and so on for state, country etc..?
If the answer is no, can it be done with custom code on the specific field?
If the answer to that is no as well, what would be simplest way to do it like you said? I do have all addresses also saved as separate fields in the database in addition to the main single Google Address field (meaning I have 6 extra fields created just for separating the address into individual fields, and they are "Address Line 1", "Address Line 2", "City", "State", "Zip", "Country") - if this were the case, I am assuming I would need to create multiple new input fields in order to enable users to be able to search by zip, and by state, and by city etc... This sounds big so I hope there is a way to do it the first way I mentioned above 🙂
Whichever the answer is, I understand if you can't send me over an entire snippet of custom code that would be required to make this work, but would you be able to at least start me off in the direction?
And another search will we can say is based on the post custom fields, taxonomies (terms). Where for instance if you have a zipcode custom field that holds the zipcode value inside the database (postmeta table), then you can add this zipcode field as frontend filter where use can enter the zipcode and based on the provided zipcode it will search within the database and search for the zipcode against the provided zipcode value and display the found results.