Skip to content

How I fixed loading WP Google Maps Pro with Autoptimize

How I resolved an incompatibility between WP Google Maps Pro and Autoptimize plugins preventing maps from initializing correctly.

I was working on a client’s WordPress-powered website recently, one that uses WP Google Maps 7.10.45 with the Pro add-on 7.10.44 to display the business locations as map pins. As part of tuning performance, I configured Autoptimize 2.5.0 to aggregate and minify CSS and JS assets.

It unfortunately seems that there is currently an incompatibility between the two plugins that causes maps to not initialize. I was able to resolve the issue by excluding some of the WP Google Maps Pro JavaScript assets from aggregation and minification.

Add the following path fragments to Autoptimize’s JavaScript exclusion list:
wp-google-maps-pro//js/core.js, wp-google-maps-pro/js/v8/wp-google-maps-pro.min.js

Note: the double slash in the core.js segment is intentional and mirrors a minor defect in the version of WP Google Maps Pro as listed.