Manipulating cookie on specific taxonomy archive page

After googling around I found the correct way to do it by using the ‘wp’ hook

if (is_tax(‘term-country’))

add_action(‘wp’, ‘my_setcookie’);
// my_setcookie() set the cookie on the domain and directory WP is installed on
function my_setcookie(){
$path = parse_url(get_option(‘siteurl’), PHP_URL_PATH);
$host = parse_url(get_option(‘siteurl’), PHP_URL_HOST);
$expiry = strtotime(‘+1 month’);
setcookie(‘location’, ‘my_cookie_value_3’, $expiry, $path, $host);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)