Adding support for DONOTCACHEPAGE
-
Hi!
I would like to exclude certain pages from caching dynamically using DONOTCACHEPAGE constant. As you may know this is a constant supported by most caching/optmization plugins, for example:
* WP Super Cache
* W3 Total Cache
* WP Rocket
* Autoptimize
* SG Optimizer
* Comet CacheBut for some reason WP Fastest Cache doesn’t support it ??
Looking at the plugin code I can see it’s only accepted on a very specific use case, pages with 503 error when Wordfence is active:
// for Wordfence: not to cache 503 pages if(defined('DONOTCACHEPAGE') && $this->isPluginActive('wordfence/wordfence.php')){ if(function_exists("http_response_code") && http_response_code() == 503){ return $buffer."<!-- DONOTCACHEPAGE is defined as TRUE -->"; } }
Would be great if you can add support to exclude any page where DONOTCACHEPAGE is set to true, no matter if Wordfence is enabled or if it’s a 503 error page.
You would need only to remove the extra checkings from that if statement, or add a new one before it with only DONOTCACHEPAGE checking if you don’t want to change the above snippet. I would love to submit a pull request if you have a Github repo (I was unable to find any).
Being your caching plugin so popular, I’m sure many users would be happy of seeing this added.
Thanks!
- The topic ‘Adding support for DONOTCACHEPAGE’ is closed to new replies.