Closed pacotole closed 3 years ago
I can imagine a couple scenarios when this would be needed. In case there is a different approach and to better understand your setup, what bypass check(s) are you trying to avoid that is causing the page to be bypassed?
As for the potential hook in the Cache_Enabler_Engine::is_cacheable()
method, would that be just JSON saved in an HTML file? As you may already know, the cache signature is appended later on (HTML comment in bottom of the page source), which may make that invalid if I'm understanding your use case correctly.
In my case, a third party plugin is declaring DONOTCACHEPAGE constant but in some customized pages that don't change I would like to use 'cache_enabler_bypass_cache' filter to don't bypass cache.
About JSON ouput, you are right. I hadn't thought of the html comment.
Is the third party plugin checking if it is defined first? If yes, would that allow you to define it as false
beforehand on these customized pages to prevent them from being bypassed?
Current
'cache_enabler_bypass_cache'
filter only allow "to force bypass" the cache:In some scenarios we want "to force not to bypass" the cache. It only takes a small change:
If it's okay with you, I can make a pull request.
Note: A filter for the is_cacheable() function would also be great (e.g. I would like to cache the output of custom post that return data in json format).