当用户在分类法归档页面上调用“术语国家”时,我有此代码来设置cookie
if (is_tax(\'term-country\'))
add_action(\'init\', \'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);
}
当我添加is\\u tax()函数时,代码将不起作用当我删除is\\u tax()函数时,代码将起作用我的代码有什么问题吗?