Q: I suppose "static conditions" (taxonomy terms, custom fields, etc.)
should work with page caching. But "dynamic conditions" (user agent, referrer, geolocation, etc.) probably won't work with caching. User-based conditions obviously can't work with caching...
Is my understanding correct? Or maybe some "dynamic conditions" can work with caching, with some tricks?
Morgan_ConditionalBlocksPro
Aug 23, 2024A: Yes, you are correct - "Static conditions" (conditions which always result in the same output) will work fine with caching plugins.
Page cache is created after the conditions have run, and the final page content has loaded.
If you are creating "dynamic conditions" (where content is always changing, or specific to users) then you should consider possibly opt-ing out of page cache for the page. But not always!
If your conditional content is only for logged in users, then most hosting companies already bypass cache. There's a few more cases hosts passed automatically:
1. If the customer has products in a WooCommerce cart.
2. checkout/account pages
It's best to check the hosting settings on your server.
I do have a tip as well. Try to consider the content you are creating, if it's semi dynamic or time based - then check your cache lifespan.
I generally prefer to set a cache lifespan of 1 or 2 hours for performance while still allowing for fresh cache regularly.
I hope that helps!