Can we not load CSS and JS on non-map pages?

Is there a way to not load google_maps_user.css and google_maps_loader.js on every page of my site?

  • Mason
    • DEV MAN’s Sidekick


    As we haven't heard back from you we're going to assume the problem
    was sorted out and mark this ticket as resolved.

    If it wasn't resolved, or you have any more questions related to this
    thread please feel free to post them below and tick the 'Mark as Not
    Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and for being a member of WPMU
    DEV, it's a pleasure to help you out and we look forward to being of
    assistance in the future.


  • thoncs
    • WPMU DEV Initiate

    Um, nope. Every page of my every one of my sites that uses the maps plugin loads

    <link rel='stylesheet' id='agm_google_maps_user_style-css'  href='' type='text/css' media='all' />
    <script type="text/javascript">if (typeof(_agmMaps) == "undefined") _agmMaps = [];</script><script type="text/javascript">var _agm_root_url=""; var _agm_ajax_url=""</script><script type='text/javascript' src=''></script>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript'>
    /* <![CDATA[ */
    var l10nStrings = {
    	close: "Close",
    	get_directions: "Get Directions",
    	geocoding_error: "There was an error geocoding your location. Check the address and try again",
    	missing_waypoint: "Please, enter values for both point A and point B",
    	directions: "Directions",
    	posts: "Posts",
    	showAll: "Show All",
    	hide: "Hide",
    	oops_no_directions: "Oops, we couldn\'t calculate the directions"
    /* ]]> */
    <script type='text/javascript' src=''></script>

    You'll notice it actually loads google_maps_user.js twice. This is from version on a page without an embedded map. This is the case regardless of the theme in use.

  • thoncs
    • WPMU DEV Initiate

    No. Still loads on every page of each site on which it's installed.

    Moreover, in trying to secure my Admin areas with the FORCE_SSL_ADMIN option, the plugin pulls in a bunch of stuff over an unalterable/hardcoded insecure http call (see screenshot), so I can't even FORCE_SSL_LOGIN.

    Note that this is on wp-login.php (!?)

  • Vladislav
    • Dead Eye Dev


    Embedding a created map in your post is just one way in which the map can appear in your page. There are a lot of other ways in which this can happen (widgets, autocreated maps, dynamic maps, add-ons, template tag) with a lot of edge cases, so including them on public pages is the safe choice. Also, if you look closely at the embedded URLs, you'll notice that the scripts aren't actually included twice.

    However, SSL compatibility is an excellent point. This issue should be fixed with the latest plugin release (v2.4.1, just released).

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.