Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am trying to make my custom cookie to remain on all pages when triggered...
add_action('woocommerce_thankyou', 'my_setcookie');
function my_setcookie(){
$path = parse_url(get_option('siteurl'), PHP_URL_PATH);
$host = parse_url(get_option('siteurl'), PHP_URL_HOST);
$expiry = strtotime('+2 days');
setcookie('madeorder', 'yes', $expiry, $path, $host);
}
it successfully triggers on thank you page, but when i navigate to another page it is gone...
Have i done something wrong?