Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Last active October 26, 2023 11:29
Show Gist options
  • Save yuriinalivaiko/3d4dfe171a04f64d9b601e8aa34fe5e1 to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/3d4dfe171a04f64d9b601e8aa34fe5e1 to your computer and use it in GitHub Desktop.
This code snippet disables the ability to pan and zoom the map in the extension User Locations.
<?php
/**
* Disable the ability to pan and zoom the map.
*/
add_action( 'wp_footer', function () {
?><script type="text/javascript">
function um_user_locations_customize_02 ( args, hash, directory ) {
args.zoom = 4;
args.zoomControl = false;
args.gestureHandling = "none";
return args;
}
// customize the map in the member directory.
wp.hooks.addFilter( 'um_user_locations_map_args_init', 'um_user_locations', um_user_locations_customize_02 );
// customize the map in profiles.
wp.hooks.addFilter( 'um_user_locations_map_field_args_init', 'um_user_locations', um_user_locations_customize_02 );
</script><?php
}, 20 );
@yuriinalivaiko
Copy link
Author

yuriinalivaiko commented Jul 10, 2022

This gist is a part of the article User Locations - Hooks.
Related article - Disabling Pan and Zoom.

You can add this code to the functions.php file in the active theme directory. Skip the opening <?php tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment