Specify language for geolocation

Note: All code examples on this site are provided for developer reference/guidance only and we cannot guarantee that they will always work as expected. Our support policy does not include assistance with modifying or debugging code from any code examples, and they may be changed or removed if we find they no longer work due to changes in our plugins.

When you enter the location of a job, WP Job Manager will fetch data about this location from Google. This isn’t used by default, but some themes/add-ons use it to display jobs on maps etc.

This geolocation data will default to the site’s language selected in Settings -> General.

To specify another language to be used for geolocation, you can add the following code to your theme’s functions.php file, and replace the “en_GB” with the code for your chosen language:

// Add to theme functions.php
add_filter( 'job_manager_geolocation_endpoint', 'change_geocode_lang' );
function change_geocode_lang( $endpoint ) {
  // Use language from https://developers.google.com/maps/faq#using-google-maps-apis
  return add_query_arg( 'language', 'en-GB', $endpoint );
}

You can find available language codes here.

Code Snippets Documentation