I'm in a bit of a bind. I'm using W3TC, with the "Prevent caching of objects after settings change" option enabled, so that pagespeed service can be refreshed when needed.

Unfortunately, this adds query strings to everything, including a call to a remote .js file (which is included in one of the template files), which I need to exclude– unfortunately it breaks if there's a query string (which is something that's out of my control to fix).

Is there a way I can just have this bit of HTML be excluded from the W3TC filter somehow? I'm open to calling the page in question with a GET query, but so far can't find a way to make it work.

closed as off-topic by Mark Kaplun, birgire, Johannes Pille, gmazzap, Pieter Goosen Aug 26 '14 at 4:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, birgire, Johannes Pille, gmazzap, Pieter Goosen
If this question can be reworded to fit the rules in the help center, please edit the question.


Got it to work:

In wp-config.php I added:

define('W3TC_DYNAMIC_SECURITY', 'mysecretcode');

I created a PHP file (nocache.php) containing just the HTML to be output, and put it in the root folder. Then in my template file I used:

<!-- mclude mysecretcode nocache.php --><!-- /mclude mysecretcode -->

Not the answer you're looking for? Browse other questions tagged or ask your own question.