I have a Wordpress page and I need to do the following:
- check if a cookie with the name
petar_cookieexists before the page loads - if no cookie, load the page as usual
- if yes cookie, redirect to a different URL
Is there a way to accomplish this in Wordpress?
I have found some plugins that allow you to enter PHP code into a page, but this doesn't help - I can't redirect from PHP once the page has started loading.
So, I need a way to insert PHP code before the <head> portion of the page and I need it to be able to read the $_COOKIE array at that point.