Map field
The Map field (type google_map, as in ACF) works without an API key: it uses OpenStreetMap tiles and Nominatim search. With a key, it uses Google Maps and the Geocoding API.
Value
The value is an array, as in ACF:
address,lat,lngandzoom;- address parts:
city,country,post_code,place_idand so on.
php
$shop = get_field( 'shop' );
printf( '%s (%F, %F)', esc_html( $shop['address'] ), $shop['lat'], $shop['lng'] );Google Maps key
Set the key in any of these ways:
php
define( 'WPFF_GOOGLE_MAPS_API_KEY', 'your-key' ); // wp-config.php
wpff_update_setting( 'google_api_key', 'your-key' ); // or acf_update_setting(), as with ACFThe acf/fields/google_map/api filter works too.
Filters
| Filter | Purpose |
|---|---|
wpff/fields/google_map/api_key | Google Maps API key. Return '' to use OpenStreetMap. |
wpff/fields/google_map/tiles | Tile server: [ 'url' => …, 'attribution' => … ]. |
wpff/fields/google_map/geocoder_url | A Nominatim-compatible geocoder. |
External services and privacy
These services are contacted only from admin screens that show a Map field, and only to load the map and run the searches an editor starts. The plugin itself sends no data anywhere.
- OpenStreetMap tiles (tile.openstreetmap.org), without a Google key: the browser loads map images for the area shown. Tile usage policy, privacy policy.
- Nominatim (nominatim.openstreetmap.org), without a Google key: the browser sends the searched address, or the coordinates of a clicked point. Usage policy.
- Google Maps JavaScript API and Geocoding API, only with a key. Terms, privacy policy.
Map editor: Leaflet (BSD-2-Clause). Map data © OpenStreetMap contributors (ODbL).