Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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 -->
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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