1. Home
  2. Docs
  3. Custom Code Samples
  4. Checkout Map
  5. How to change map language

How to change map language

By default, LPAC uses the language set in WordPress->General Settings->Site Language, some plugins like WPML can sometimes affect the value of get_locale() function, in those cases you can manually set which language the map should use with the lpac_map_locale filter, simply pass the language code for the language of your choice to the filter:

PHP
function lpac_set_map_language( $site_locale ){
  return 'ar';
}
add_filter( 'lpac_map_locale', 'lpac_set_map_language' );

The above piece of code will set the map language to Arabic. For all supported languages and their language code, please see this doc.


If you’re changing the map language, you might also want to set a specific region for it. Use the following snippet to accomplish this:

PHP
function lpac_additional_maps_parameters($empty, $maps_api_link){
  $additional = array(
	            "region=AE",
	        );
  return $additional;
}
add_filter( 'lpac_additional_map_params', 'lpac_additional_maps_parameters', 10, 2 );

In the above snippet change AE to reflect the specific region for your country. You can find a list of supported regions and their here.

Was this article helpful to you? Yes No