wpsl_gmap_api_params

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

Description

This filter allows you to modify the Google Maps API parameters.

If your site is multilingual, you can use this filter to set the language parameter dynamically.

This will ensure that the user will always see textual information like driving directions and labels in the active language of your site.

Parameters

$api_params - (string) The Google Maps API parameters.

Usage

The first two examples show how to dynamically set the language parameter, and assume that you either use WPML or qTranslate X to make your site multilingual.

If you use a different plugin, then you should check the relevant documentation on how to get the current language code.

If you have set the map language on the settings page:

If you have not set the map language on the settings page:

It’s also possible to load an older version of Google Maps by including the ‘v’ parameter as shown below. You can see a list of available versions here.

Changelog

Since 1.2.20

Source File

This filter is located in /inc/wpsl-functions.php.

Placement

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