Protect certain pages by cookie value
-
I would like to protect a (small number of) pages based on a cookie. If the cookie is set, the visitor sees the page. If the cookie is not set, he redirects to some other page, which can be a WP page, external PHP, whatever it takes. That page asks him a question, and if the user says yes it sets the cookie then redirects him to the page he was going to initially. If he says no, it takes him back to the top of the site.
In other words, I’d like to have a cookie-based age gate.
The number of pages that I’m trying to protect is relatively small, so it’s not too onerous a task for me to drop a chunk of code onto every page if necessary. It doesn’t have to be elegant, it just has to work.
I’ve tried making my way through the vast array of plugins available, but I haven’t found quite the right thing yet. Either that, or I didn’t recognize the right thing when it said “Boo!” to me, which is also entirely possible.
Is there something out there that will let me do what I want without too much work? If not, what’s the best strategy for approaching this? I’m a developer but not much of a web developer, so I have no problem writing whatever code I need… I just don’t know the landscape well enough to be able to come up with a strategy.
- The topic ‘Protect certain pages by cookie value’ is closed to new replies.