DONOTCACHEPAGE Breaks Cache on Entire Site
-
I was very excited to find your plugin after I had enough with another plugin gaining even more bloat and requiring me to make some further compatibility changes on our site for the latest update to said plugin. Thank you for making your solution available.
While I was going through testing all the changes we made to move over to your plugin, I discovered that page caching was disabled everywhere on frontend regardless of whether a download was involved. I tracked it down to the following line from
inc/functions.core:244
if (!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true);
In testing, I found setting the constant to false or removing the line resolved the caching problem.
Since your function
simple_download_counter_download_handler()
runs on every frontend page and even some admin pages, I recommend trying to find a better way to define the constant only when a download is requested. For example, I tried moving the line inside of the if statement at line 268, and all seems well, though I am sure you could come up with something better since you know your own code.Thank you for considering this issue.
In case you need to know, I am using the WP Rocket plugin for our page caching, and they do respect the DONOTCACHEPAGE constant (source: https://docs.wp-rocket.me/article/141-force-page-caching).
- The topic ‘DONOTCACHEPAGE Breaks Cache on Entire Site’ is closed to new replies.