I have set the cookie in header.php like below
<?php if($_GET['signup'] == '123' && !isset($_COOKIE['sign'])){
setcookie("sign", "1", time()+3600);
} ?>
now i need to get this cookie value in the page signup.php. but i cant retrive the value in that page. in Signup.php page i am using the below code for check the cookie,
<?php
/**
Template Name: Sign Up
*/
$ck = $_COOKIE['sign'];
echo "cookie".$ck;
if(isset($_COOKIE['sign'])){
header("Location: https://www.ap.com/app/signup.jsp?signup=123");
}
else
{
header("Location: https://www.ap.com/app/signup.jsp");
}
?>
but it goes to the else condition only (if the cookie is set also). kindly advice…
Try to create a plugin and hook with init action: http://codex.wordpress.org/Plugin_API/Action_Reference/init