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:
<?php
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';
wp_safe_redirect($url);
echo $_COOKIE['tmpCookie'];
exit();
}
}
?>
Any advise is appreciated.