• sammiefields2512gmailcom

    (@sammiefields2512gmailcom)


    Hi all

    I’ve been searching on the net for a solution to my problem all day, but I can’t make sense of anything I see, since I know absolutely NOTHING about coding.

    Here’s what I’d like to do.

    1. I’d like to set a cookie when a person visits one particular page on my website, let’s call it Page 1.
    2. Then, when that visitor goes to another unrelated page (Page 2), he/she gets automatically redirected to Page 3 (because of the cookie that was set when they visited Page 1). Visitors without the cookie, don’t ever get to see Page 3.

    Is this doable?

    Oh, and by the way, I’m on a self-hosted WordPress site.

    Thanks so much.

    Sammie

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    This is possible, but it’s not a simple “Add this short code snippet to functions.php” and everything will will work (AFAIK). You’ll need someone with some coding experience, unless you are willing to put in the time and effort to learn a little PHP coding.

    The main functions involved are setcookie() and header(). The purpose of setcookie() is obvious, header() is used to alter the page location the browser is going to. These must be executed before any content is sent out to the client browser. This means a hook must be identified which can see which page is being requested and executes early enough that no content has yet been sent.

    The last paragraph probably makes no sense, but it’s useful to whom ever is doing your coding. Or you may choose to study enough PHP until it makes sense to you. Good luck!

    Thread Starter sammiefields2512gmailcom

    (@sammiefields2512gmailcom)

    Thanks for your reply bcworkz. I can see you replied to my more recent post as well, so I’ll discuss with you there 😉

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Please stop duplicating the same thread.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting A Redirect Cookie on WordPress’ is closed to new replies.