How to Enable Single Sign-On (SSO) Across Your WordPress Multisite Network
Content
One of the most common challenges for WordPress Multisite administrators is managing user logins across multiple domains or subdomains. Users expect a seamless experience where logging into one site grants them access to all sites they are authorized for within the network. This is often referred to as Single Sign-On (SSO). Based on community discussions, this guide will explain why this happens and walk you through the most effective solutions.
The Core Problem: Cookie Domains
By default, a standard WordPress Multisite installation is configured to handle a network of subdomains (e.g., site1.example.com, site2.example.com) or subdirectories (e.g., example.com/site1, example.com/site2) under a single primary domain. WordPress uses cookies to keep users logged in. These cookies are typically scoped to a specific domain.
When you introduce completely different top-level domains (TLDs) like domain-a.com and domain-b.com, the browser's security model prevents cookies from one domain from being read by another. This is why a user logged into site1.mydomain.com appears logged out when they navigate to site2.mydomain.com or, more drastically, a different TLD entirely.
Common Solutions for a Unified Login Experience
Solution 1: Configure Cookie Sharing in wp-config.php (For Subdomains)
If your network uses subdomains, you can often solve the login persistence issue by explicitly defining the cookie domain in your wp-config.php file. This tells WordPress to set its authentication cookies for the entire root domain, making them available to all subdomains.
define('COOKIE_DOMAIN', '.mydomain.com'); // Note the leading dot
Important Note: As seen in the community threads, this solution is primarily effective for subdomains of the same root domain. It will not work for mapping completely different TLDs (e.g., domain-a.com and domain-b.com). Some users have reported that setting this value to false can resolve login issues if other configurations cause problems.
Solution 2: Use a Single Sign-On (SSO) Plugin
For networks that use domain mapping with different TLDs, the most robust and commonly recommended solution is to implement a Single Sign-On plugin. These plugins work by centralizing the authentication process on one main site.
When a user attempts to access a restricted page on a mapped domain (e.g., domain-b.com), they are redirected to the main site to log in. After successful authentication, they are redirected back to the mapped domain with a token that proves their identity, effectively logging them in there as well.
The community frequently suggests exploring SSO plugins as a reliable method to achieve this cross-domain login behavior. It is advisable to search the WordPress Plugin Directory for "Multisite SSO" or "Single Sign-On" to find a solution that fits your specific network setup.
Solution 3: Centralized Login and Logout Pages
A related goal for many administrators is to force all logins and logouts to occur through a single, central URL (e.g., example.com/login). This improves user experience and simplifies management. This can often be achieved through a combination of:
- Custom code using filters like
site_urlandwp_redirect. - Dedicated plugins designed to customize WordPress login behavior.
- Careful configuration of login links within your theme or menus.
A Note on User Access vs. Authentication
It is crucial to distinguish between being authenticated (logged in) and having access to a site's backend. A user may be logged into the entire network but still have no role or capabilities on a specific subsite. By default, a user registered on one subsite will have a "Subscriber" role on all other sites in the network, but they will not appear in the user list of a subsite until an administrator explicitly adds them and assigns a higher role. This allows for fine-grained control over who can actually administer or create content on each individual site.
Conclusion
Achieving a seamless login experience across a WordPress Multisite network, especially one with mapped domains, requires moving beyond the default configuration. For subdomain networks, tweaking the COOKIE_DOMAIN constant in wp-config.php is often sufficient. For more complex setups involving multiple top-level domains, implementing a Single Sign-On plugin is the most effective and widely recommended path forward by the community.
Related Support Threads Support
-
User role stay logged in across multisitehttps://wordpress.org/support/topic/user-role-stay-logged-in-across-multisite/
-
Single login for multisite with domain mappinghttps://wordpress.org/support/topic/single-login-for-multisite-with-domain-mapping/
-
multisite with different tld, frontend users should have access to allhttps://wordpress.org/support/topic/multisite-with-different-tld-frontend-users-should-have-access-to-all/
-
How to disable single sign on? Only login to multisite if user existshttps://wordpress.org/support/topic/how-to-disable-single-sign-on-only-login-to-multisite-if-user-exists/
-
Multi site – display user site on a pagehttps://wordpress.org/support/topic/multi-site-display-user-site-on-a-page/
-
Default user role in multisitehttps://wordpress.org/support/topic/default-user-role-in-multisite/
-
How to set up multisite which will share same logins and the same usershttps://wordpress.org/support/topic/how-to-set-up-multisite-which-will-share-same-logins-and-the-same-users/
-
Global login for subsiteshttps://wordpress.org/support/topic/global-login-for-subsites/
-
How to use the same dashboard for all sub sites?https://wordpress.org/support/topic/how-to-use-the-same-dashboard-for-all-sub-sites/
-
Registered usershttps://wordpress.org/support/topic/registered-users-12/
-
Keep logged in across multisite (for various domains)https://wordpress.org/support/topic/keep-logged-in-across-multisite-for-various-domains/
-
Access managementhttps://wordpress.org/support/topic/access-management-2/
-
Use the same dashboard for all sites on a mutisite installationhttps://wordpress.org/support/topic/use-the-same-dashboard-for-all-sites-on-a-mutisite-installation/