How do I turn off the WP Super Cache & W3 Total Cache functionality programmatically? For instance, I neither want to make it use the cache on some requests nor cache the output of the request, do they support that using filters? I couldn't find anything useful in their documentation.
closed as off-topic by mrwweb, Pieter Goosen, Nicolai, Johannes Pille, birgire Aug 28 '14 at 13:16
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." – mrwweb, Pieter Goosen, Nicolai, Johannes Pille, birgire
Easiest way to do this was to define a constant programmatically:
// Tell WP Super Cache & W3 Total Cache to not cache WPReadable requests define( 'DONOTCACHEPAGE', true );
Both plugins you mention have settings pages that allow you to add directories or specific files to not cache.
These setting files are saved as text files in the relevant directory. You should be able to programatically 'append' your /mobile-theme/ directory to these settings files.
As per this question, you can use fragment caching to exclude specific things from being cached:
Edit your templates to with the following syntax to ensure that dynamic features remain so: Example 1:
<!-- mfunc any PHP code --><!-- /mfunc -->
<!-- mfunc -->any PHP code<!-- /mfunc -->
<!--MFUNC --> echo rand(); <!--/mfunc -->
<!-- mclude path/to/file.php --><!-- /mclude -->
<!-- mclude -->path/to/file.php<!-- /mclude -->