W3 Total Cache
[resolved] How can I prevent W3TC adding a query string for a specific file? (4 posts)

  1. macgamer
    Posted 2 years ago #

    I have a bit of an odd problem. I need to have "Prevent caching of objects after settings change" enabled, because I'm using Google PageSpeed Service, but one script in particular (called directly inside a template file) needs to not have a query string on it.

    I can't seem to find a way to prevent W3TC from adding a query string to just this script.


  2. UnlockTheMind
    Posted 2 years ago #

    I have the same problem with Google Tag Manager as I describe here.

    As long as W3TC keeps messing up the link to GTM I can't activate mthe "Prevet caching of objects after settings change" feature, which I would very much like so that the CDN will update and pull a new file if a media library item is updated.

    Anyone have any suggestions?

  3. macgamer
    Posted 2 years ago #

    OK I got it to work. I put the js script html in a separate php file, then used the mclude directive to load it.

  4. UnlockTheMind
    Posted 1 year ago #

    My solution with the google tag manager code was to modify the google script slightly so that W3TC didn't recognize a path to a .js file.

    I changed this: j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;

    to this: j.src='//www.googletagmanager.com/gtm.'+'js?id='+i+dl;

    And then W3TC doesn't try and append it's querystring right after the id= and mess up the GTM ID necessary to call the script for our account.

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