wpsl_geocode_components

  1. Description
  2. Usage
  3. Changelog
  4. Source File
  5. Related

Description

This filter enables you to modify the parameters included in the geocode component filter.

If you, for example, search for Springfield, then the first result the Geocode API returns is located in Massachusetts. Which is fine if your store is actually located in Massachusetts, but if it’s located in Illinois, then the only thing the user will see is a “No results found” message.

To fix this you can use this filter to restrict the results by administrativeArea, country, locality, postalCode and route.

This only works if a default map region is selected on the settings page, and the “Restrict the geocoding results to the selected map region?” checkbox that shows up after selecting a map region is enabled as well.

Usage

This example restricts the returned geocode results to Illinois:

Changelog

Since 2.1

Source File

This filter is located in /frontend/class-frontend.php