W3 Total Cache
plugin conflict with Leaflet Maps Marker (CDN/js issue) (3 posts)

  1. RobertHarm
    Posted 3 years ago #


    I am the developer of the mapping plugin "Leaflet Maps Marker" (http://wordpress.org/extend/plugins/leaflet-maps-marker/) and found a conflict with w3tc plugin:

    If w3tc is active and a CDN (like Amazon Cloudfront) is set up, my layer maps break, as w3tc removes the trailing slash from my icon-dir constants:

    javascript output without w3tc and inactive CDN (taken from http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-fullscreen.php?layer=1)

    iconUrl: (feature.properties.icon != '') ? 'http://www.mapsmarker.com/wp-content/uploads/leaflet-maps-marker-icons/' + feature.properties.icon : 'http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker.png',

    javascript output with w3tc and active CDN:

    iconUrl: (feature.properties.icon != '') ? 'http://cdn.mapsmarker.com/wp-content/uploads/leaflet-maps-marker-icons' + feature.properties.icon : 'http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker.png',

    I tried to fix it on my side, but didnt succeed - I guess this is a bug with w3tc (especially the newer version, as with older versions - dont ask me which one - image url werent replaced within javascript-tags).

    Here is the code I use within my plugin to create the output above in case this helps you with analyzing:

    $lmm_out .= " iconUrl: (feature.properties.icon != '') ? '" . LEAFLET_PLUGIN_ICONS_URL . "/' + feature.properties.icon : '" . LEAFLET_PLUGIN_URL . "leaflet-dist/images/marker.png" . "',".PHP_EOL;

    The current workaround I give is to add
    to the list of rejected files within the w3tc CDN configuration. This is not optimal, as I would like my plugin to work out of the box without any additional configuration needed.

    I would really appreciate your help with this issue. If I can assist you in any way, let me know!



  2. RobertHarm
    Posted 3 years ago #

    any updates on this issue? didnt seem to fix this issue...
    thanks for your help!

  3. RobertHarm
    Posted 3 years ago #

    are there any updates on this ticket? I am getting more and more feedback from my users that they are experiencing this issue...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic