Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Descrição

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.

Parâmetros

Esta ação não aceita nenhum parâmetro.

Mais Informações

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.

Fonte

wpforms-geolocation/src/Map.php

Exemplos

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