Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
W3 Total Cache's approach to conditional loading is rather elegant.
<?php
/**
* Skip caching for some pages
*/
switch (true) {
case defined('DONOTCACHEPAGE'):
case defined('DOING_AJAX'):
case defined('DOING_CRON'):
case defined('APP_REQUEST'):
case defined('XMLRPC_REQUEST'):
case defined('WP_ADMIN'):
case (defined('SHORTINIT') && SHORTINIT):
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.