bluehost / endurance-page-cache

Other
25 stars 12 forks source link

epc_exempt_uri_contains runs before theme #1

Closed vdwijngaert closed 7 years ago

vdwijngaert commented 7 years ago

Great start!

I couldn't help but notice this line of code:

$this->cache_exempt = apply_filters( 'epc_exempt_uri_contains', array( 'wp-admin', '.php', 'checkout', 'cart' ) );

This implies that you can alter the array of cache exceptions. I could be wrong, but doesn't this line of code run before the theme initializes? I think plugins that are being loaded after EPC don't get a chance to hook into that filter as well.

MikeHansenMe commented 7 years ago

You are correct. You would have to include another mu-plugin to get in there before that runs. I could update it to be an option with that array as the default. Then a theme/plugin could modify that option and get in there before the theme/plugin even loads.

Thanks for catching this and opening an issue.

vdwijngaert commented 7 years ago

Happy to help! :)

MikeHansenMe commented 7 years ago

I think I found a better solution that an option by just moving the filter where it can be hooked (on init before 10). Let me know if you see anything wrong with it or have any questions.

https://github.com/bluehost/endurance-page-cache/commit/a6203b7efa6c1671bac9b2af11ca2a895f0d3fe2