WordPress.org

Support

Support » Plugins and Hacks » Hacks » managing cookies for a specific page

managing cookies for a specific page

  • Hi
    I’m trying to do something like this:
    I want every first time visitor to my site to be redirected to a registration page(for a mailing list, not site registration) and after the registration to be redirected to a thankyou page where a cookie will be set to prevent this process to happen on the next visit to my site.

    I created a function for creating a cookie if it doesn’t exist in the functions.php file and I also call it there.

    Here are the problems I still have:
    1. I want the cookie to be set only in the thankyou page. I tried doing it with a condition in the function “is_page(3)” but the page id is not loaded yet when functions.php is loaded.

    2. Maybe this is a beginners question: how do I redirect to another page from within the wordpress page?

    *The redirection from the registarion to the thankyou page are done automatically by the mailing list registration butoon so I don’t need to do anything there.

    Thanks in advance
    Akiva

Viewing 1 replies (of 1 total)
  • 1. You need to do this in during a hook, probably init. If you don’t know about hooks and filters, you can read up about them on the WP Codex.

    2. You can use the wp_redirect() function.

Viewing 1 replies (of 1 total)
  • The topic ‘managing cookies for a specific page’ is closed to new replies.
Skip to toolbar