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
- Unable to change blog language in multisite
- Multisite logged into one wp-admin, move to another sites wp-admin asked to login again
- How to use WordPress Multisite With Different Domain Names?
- How To Add Custom Form Fields To The User Profile Page?
- Where are available Roles Defined in the wp_ database?
- restore_current_blog() vs switch_to_blog()
- Can i merge 2 new WP_Query($variable) ‘s?
- How to disable a network enabled plugin for just one site?
- How to reliably flush rewrite rules on multisite?
- Site Redirecting to wp-signup.php
- Moving a WP Multisite to a subdirectory
- Cookies in multisite where network sites have their own domain name
- Convert a Multisite WordPress install into a Single site
- WordPress MultiSite Active Directory integration and site privacy
- WordPress Job Interview Preparation
- How to add Custom Blog Options to new blog setup form?
- How can I trust switch_to_blog()?
- Remove the blog slug from WordPress Multisite root node
- Why are my roles not visible in a Multi-site/Network?
- Site admin in a network install can’t edit users?
- How to use same email for multiple users
- How to run an activation function when plugin is network activated on multisite?
- Specific upload folder for PDFs in custom Post type in WP multisite
- What is the correct way to map multiple domains in a WordPress 4.1 multisite install?
- Where can I find documentation on what characters are allowed in user names and why?
- How to migrate subsite from dev multisite to production multisite
- How can I un-reserve a pending username registration?
- How do I remove/delete an old super admin user?
- DB connection error after copying a WordPress Multisite instance to a second location
- Redirect Main Site to Subsite in Multisite WordPress
- Is there a is_user_logged_in() for multisite?
- Switching MultiSite installation from HTTP to HTTPS
- Allow user to select a theme to install when they signup
- Setting up a wordpress network with third level domains
- Get upload URL by blog ID in multisite
- What’s the difference between get_site_option and get_blog_option?
- Need help sorting “My Sites” Alphabetically
- How to delete post revisions?
- Create mobile site with same content just different theme
- Add additional Network constants to wp-config.php dynamically
- Multisite stuck at 1MB for max file size
- How to get blog name, when using WordPress Multisite
- What are options are there to implement a multi language site
- Switching primary site in WordPress Multisite
- Multisite Network Port Num Issues?
- Convert existing site to network
- Where is the robots.txt stored for a WordPress Multisite install?
- Settings API in Multisite – Missing update message
- Add WordPress MU Network Admin via Database
- How to get current site id? (WPMU)
- Multisite on Windows with wildcard subdomains
- Why is WordPress Multisite redirecting to wp-signup.php and how to fix it?
- Which asset URLs are acceptable in a “vanilla” MU install?
- $wpdb->base_prefix not get parent site prefix in multisite
- How to tell which database tables belongs to which multisite site
- what are pmxi tables? [closed]
- Using wp_insert_post() with Networking enabled
- Are nested subdomains possible with a subdomain multisite?