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.
Related Posts:
- WordPress Multisite Multiple child theme
- COOKIE_DOMAIN setting confusion
- Security in WordPress plugin development
- Hard Code Pages into a Theme for a Network (multisite) Installation
- Getting a blog language (site “lang_id” field vs the WPLANG setting)
- Display custom homepage text based on domain
- Child Theme CSS Not Overriding Parent Theme In MultiSite Site
- Trying to migrate a WordPress Multisite with Domain Mapping
- Getting an ERROR: Cookies are blocked error when logging in to a site on a different domain?
- Multisite use language code as subdirectory
- How to use both British and American English?
- PHP Notices appear when browsing any page in admin, but only for child theme, using code from WP Codex
- Subdomain login problems
- Activate Child Theme with Codex
- Child Theme activates, but nothing from parent theme displays (MAMP, Multisite)
- Grandchild themes and optimal network architecture
- Multisite: How can I have the admin bar (toolbar) use the language of the user instead of the language of the sub-site being viewed?
- How to fix blocked cookies error that doesn’t let me log into wp-admin?
- Cookie signed verification failed – wp-saving-post
- Development of new theme and rollout on multisite
- Login problems on multisite installation with different domains
- Child Theme Based on Toolbox Not Found
- Error : Cookies are blocked or not supported by your browser
- Changing the language for each individual site in wordpress multisite
- How do I stop exactly one blog from network ever setting cookies?
- Is it necessary to network enable both the parent and child theme for multisite installations?
- Multisite default theme and child applied to network
- Is there something I need to know in order to use WordPress on foreign (Swedish) TLDs?
- Multisite cookies are being shared across domains unwanted
- How can I create network with different domains?
- Multi Site Language switcher
- Language per user role, how can I achieve this?
- Downloading customized theme from wordpress
- Created child theme from Themegrill Flash-Pro and the child theme is blank
- Change header.php of a specific WordPress Multisite
- Applying Child Theme to another site, which has its own URL
- Single sign on to sub-sites in Multisite Network
- How to login a user with wp_set_auth_cookie on a specific blog within a multisite environment
- ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress
- Cookies in Multisite network where sites have their own domain name?
- WordPress Network / Multisite login to one site allow access to all
- WordPress MU: Cookie error when trying to login on network WP instance
- I want to develop locally with Multisite, then migrate each site to separate remote WP installs
- Post and Page Inheritance to subsites in a WordPress Network
- Roles other than Super admin accessing manage_network_themes
- Multisite in subfolder – How to make new sites to be in same level subfolders as the main site
- How to list all network sites on one page
- Overriding the default WP Multisite notification e-mail
- WPMU vs WordPress MultiSite is there a difference anymore?
- Multisite database upgrade SSL error
- Emailing only the users of a MultiSites Sub-Sites
- wp_logout_url isn’t forwarding to correct link
- Multiple blogs, different domain names, one install to rule them all
- Can simple Admin save options in a Multisite?
- Is there a hook or a function for multisite blog deactivate or delete?
- How does WordPress tell which post is from which site in a multisite setup?
- How to remove nodes site wide from the toolbar on multisite install
- WordPress Multisite: Have the same header and footer of main-blog on all sub-blogs
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- WordPress MU and nested sites addresses?
- Multi-site vs seperate installs for just 3 blogs?
- Installing WP twice in same Directory?
- Hosting a seperate wordpress project on localhost
- WordPress multisite in subdirectory, not root, and remove base folder from url
- No My Sites link after installing Multisite
- Speed up MU WordPress on Apache VPS?
- Buddypress on Multisite – Member List
- How do I use different URLs in a single WordPress installation?
- Removing a wordpress multisite installation and preserving the database before migrate to nginx
- Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter
- Error uploading files bigger than 58 MB
- Multisite registration problem [closed]
- Some PDF files get Forbidden Access and other open normally on the same directory subsites
- Link structure, WordPress IIS
- WordPress MultiSite Theme
- Multisite, Subdomain, shared NFS directory Linux HELP
- Multisite install w/ Sub domains on a subdomain
- How to get blog_id of an MU site when running a custom function on the parent site
- WordPress multisite domain
- WordPress multisite not work wp-admin
- How to install seperate theme on certain page
- Using Same User Database on Subdomain
- Multisite subdomain-site redirects to primary site
- Permission warning in wordpress multisite
- Static directories in a WordPress multisite network
- Export / import
- How to post same content on multisite?
- Configure redirects with web.config
- Events Calendar Multisite 404 for events
- WordPress Database Cleanup
- Multisite – How sync posts to multi sites
- WordPress multi site network setup on local server shows sub-directories error
- Optimal setup for Multi Domain WordPress with Woocommerce
- Blog switch wpml string translation (multi-site)
- Manually insert post into MULTISITE database: Need to specify the TABLE
- Transfer Part of Multisite to new Domain
- Is there any way to give all users access to one blog in a multisite network without using a plugin?
- Some widgets on Multisite not showing up in template for particular theme
- In a loop, do not display content that does not have a thumbnail
- Global site feed plugin/function for custom post type?