wpsl_geocode_components Filter breaks search
-
I’m trying to restrict the Search results by State and I’m using the wpsl_geocode_components Filter code from the Documentation (just replacing Illinois with Maine).
add_filter( 'wpsl_geocode_components', 'custom_geocode_components' ); function custom_geocode_components( $geocode_components ) { $geocode_components['administrativeArea'] = 'Maine'; return $geocode_components; }
When I use this filter the initial lookup after page load works (defaulting to the set location in the settings or user location if allowed).
Each additional search (City name or Zip) fails to find any results, when I remove the filter the search works fine just looks out of state for city names (zip codes work).
I checked Googles API documentation about the administrativeArea and it appears to be set correctly. The HTTP response from google gives me the boundaries for the state and the administrative_area_level_1 etc information.
It just defaults to an odd place in the middle of the state.
- The topic ‘wpsl_geocode_components Filter breaks search’ is closed to new replies.