Description

The wpforms_geolocation_map_default_location filter fires when the single entry is loaded on the Entries screen and when the form loads when enabled using the WPForms Geolocation addon.

Parameters

This action does not accept any parameters.

More Information

This filter is used to set the default longitude and latitude coordinates for the map used with the Geolocation addon. The map is viewed on the entries and on the forms.

Source

wpforms-geolocation/src/Map.php

Examples

To find the latitude and longitude coordinates, please see this reference from Google.

/**
 * Set the default lat and lng for the map.
 *
 * @link   https://wpforms.com/developers/wpforms_geolocation_map_default_location/
 * return  array
 */

function wpf_wpforms_geolocation_map_default_location() {
   
    return [
            'lat' => 51.5207,
            'lng' => -0.1550,
        ];
}
add_filter( 'wpforms_geolocation_map_default_location', 'wpf_wpforms_geolocation_map_default_location', 10 );

Documentation Reference: How to Change Default Location for Geolocation Addon