wpsl_autocomplete_options

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

Description

This filter allows you to overwrite the settings that are used to make requests to the Places API.

By default only the ‘geometry.location’ data is requested, but with this filter you can include additional data in the returned results, or set additional options that are used when a new autocomplete request is made.

Parameters

$settings - (array) The default autocomplete restrictions.

Usage

This code shows how to restrict the autocomplete results to establishments only.

If you want the Places API to return all available data, then you can use the code below. This will for example make it possible to search on street addresses as well, but since it returns all data it will also drive up the billing cost.

Other fields that you can set are listed here.

Changelog

Since 2.2.20

Source File

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

Placement

The code needs to be placed in the functions.php file inside your active theme folder.