Here's what I'd like to achieve:

  • retrieve the GET value of its parameter from http://mysite/testing/?name=302Beep
  • store it in a cookie
  • redirect to http://mysite/dashboard
  • display '302Beep' in http://mysite/dashboard page

With the help of this forum, I am able to store and redirect. But I don't know how to display it. Editted:

         add_action('template_redirect', 'affiliate_redirect');
         function affiliate_redirect() {
            if( get_query_var('name') ) {
                $tmpValue = get_query_var('name');
                setcookie('tmpCookie', $tmpValue, time()+648000, '/');
                $url = 'http://mysite/dashboard';
                echo $_COOKIE['tmpCookie'];

Any advise is appreciated.

  • Include your code... ...don't make those of us that want to help you have to go to another forum and try to guess which aspects of it you've implemented and how. Commented Jan 7, 2021 at 4:29
  • @TonyDjukic added.
    – 302Beep
    Commented Jan 7, 2021 at 4:38
  • If you use your developer tools, is the cookie still there after the redirect? I know it's not visible on the page but what about in your console? Commented Jan 7, 2021 at 14:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.