Closed mrchimp closed 7 years ago
Interesting. I use this functionality to display closeable notices to the user in a similar fashion.
Moving the cookie check client side sounds like the way to go.
Which type of caching are you using? WP-Rocket?
Yeah, rocket. It's an easy one to miss.
Problem with doing it client side is you have to render out the notification html on every page whether it's needed or not, which is kind of wasteful.
Yeah, but probably faster than an Ajax call? I'd go jQuery cookie/show+hide on this one.
Cool, I'll look into it.
In the next release, there will be a new Theme Option to enable to alerts to be displayed via Javascript instead of PHP. This will solve the caching issue.
If, for example, you use Rocket WP it will cache your homepage with the cookie notification visible. If you then dismiss the notification, it won't clear the cache. A better way would be to display this notification using Javascript. That way it's client side and be cached as much as you like.
I realise this probably isn't a big deal to you, being as you are in a sensible country that doesn't require a cookie notice, but it's causing me a right hassle.