When using xbelmondo’s modified HivePress Geolocation plugin (MapLibre version instead of Google Maps), Query Monitor displays three red “missing dependency” errors :
geocomplete : google-maps (missing)
markerclustererplus : google-maps (missing)
markerspiderfier : google-maps (missing)
These errors appear because the JavaScript files still declare google-maps as a dependency in their WordPress registration, even though the plugin now uses MapLibre instead.
Important: This is a cosmetic issue only - the maps work perfectly fine, but it clutters Query Monitor with false alerts.Add this code to your child theme’s functions.php file to properly re-register these scripts without the obsolete google-maps dependency:
add_action('wp_enqueue_scripts', function() {
$plugin_url = WP_PLUGIN_URL . '/hivepress-geolocation/assets/js/';
$version = '1.3.7';
wp_deregister_script('geocomplete');
wp_deregister_script('markerclustererplus');
wp_deregister_script('markerspiderfier');
wp_register_script(
'geocomplete',
$plugin_url . 'jquery.geocomplete.min.js',
['jquery'],
$version,
true
);
wp_register_script(
'markerclustererplus',
$plugin_url . 'markerclustererplus.min.js',
[],
$version,
true
);
wp_register_script(
'markerspiderfier',
$plugin_url . 'oms.min.js',
[],
$version,
true
);
}, 9999);
add_action('wp_print_scripts', function() {
global $wp_scripts;
$scripts = ['geocomplete', 'markerclustererplus', 'markerspiderfier'];
foreach ($scripts as $handle) {
if (isset($wp_scripts->registered[$handle])) {
$wp_scripts->registered[$handle]->deps = array_diff(
$wp_scripts->registered[$handle]->deps,
['google-maps']
);
}
}
}, 9999);
Why this fix is useful :
- Cleaner debugging - Query Monitor will only show real issues, not false positive
- Better code practices - Scripts are registered with accurate dependencie
- Performance monitoring - Easier to spot actual performance bottlenecks without noise
- No side effects - Maps continue to work exactly as before
- Future-proof - Properly declares that MapLibre (not Google Maps) is the mapping provider
After applying:
- Clear all caches (plugin cache + browser cache)
- Reload a page with maps
- Check Query Monitor, Scripts tab
- Red errors should be gone
Thanks to xbelmondo for creating this free MapLibre version of HivePress Geolocation, saving us from expensive Google Maps API fees!
This fix simply updates the WordPress script registration to match the actual dependencies used by the modified plugin.
Hope this helps other users of xbelmondo’s excellent plugin mod!