setcookie()
has the following signature:
setcookie ( $name, $value = "", $expires = 0, $path = "", $domain = "", $secure = FALSE, $httponly = FALSE )
You're setting the cookie's value to 1
in your code. I suspect you intend to do something more like
setcookie('language', $_GET['language'], time() + 1209600, "/", "example.com", false);
Notes
- This answer doesn't address the security issues in trusting that the
$_GET
data is clean. You should research data sanitization. - WordPress provides a bunch of handy constants to make something like
time() + 1209600
easier to read. You can do something liketime() + ( 2 * WEEK_IN_SECONDS )
, for example.