Changing the Location URL in Google Maps

Last update: 10 August, 2018
This guide is written for advanced users and developers.

Yoast SEO: Local and Yoast SEO: Local SEO for WooCommerce include the ability to add a Google map for your location(s). The URL in the map, by default, points to the Yoast SEO location page on your website. In some cases, you may prefer to link to a different URL.

Version 6.2 or newer

You or your developer can change the URL with the yoast_seo_local_change_map_location_url filter. This filter takes 2 params: $url (required) and $location_id.

You will find an example of how to use the filter below.

// Single location
add_filter('yoast_seo_local_change_map_location_url', 'yoast_seo_local_change_map_location_url', 10, 1 );
function yoast_seo_local_change_map_location_url( $url ) {
$url = '';

return $url;
// Multiple locations
add_filter('yoast_seo_local_change_map_location_url', 'yoast_seo_local_change_map_location_url', 10, 2 );
function yoast_seo_local_change_map_location_url( $url, $post_id ) {
// Change this to the post ID you want to match against
if( $post_id == 1 ) {
$url = '';

return $url;

Versions below 6.2

This feature is not available in older versions. Please update as soon as possible to take advantage of the new feature.

Was this article helpful? ·