Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Share login status across subdomains without network

You can try like this code:

After installation, open the wp-config.php file in Site B’s installation root, and add (or replace) the following lines shortly after the database configuration, modifying them as needed to fit your configuration:

$cookiehash = md5("http://www.example.com/");  // Use Site A's URL

define(CUSTOM_USER_TABLE,'wp_users');           //Change 'wp' to match the prefix set during
define(CUSTOM_USER_META_TABLE,'wp_usermeta');   //  Site A's installation
define('COOKIEPATH', "https://wordpress.stackexchange.com/");                      //This path should reference Site A's root
define('SITECOOKIEPATH', "https://wordpress.stackexchange.com/");                  //Should match 'COOKIEPATH'
define('COOKIEHASH', $cookiehash );

Related Posts:

  1. Cookie settings for session across WPML subdomains using custom AJAX login
  2. Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
  3. Login page ERROR: Cookies are blocked due to unexpected output
  4. Removing username from the ‘wordpress_logged_in’ cookie
  5. Getting “Cookies are blocked or not supported by your browser” on login page
  6. Login redirect_to loop with reauth=1, cookie expiry set to 1 year in past
  7. Get user ID after logging in
  8. Login with cookie but without using WordPress code
  9. Get wordpress stored cookies for custom login
  10. How to get login data (session) outside WordPress?
  11. Login cookie across multiple domains on network w/ mapping
  12. Can’t login after URL change
  13. Subdomain login problems
  14. How to set different cookies for logged in admin users and logged in non admin users?
  15. 2 wordpress blogs with 1 users table and 1 login
  16. Logins through alias
  17. v5.6.2 User cannot stay logged in – wordpress_test cookie placed but not auth cookies
  18. Removing wordpress cookie from non-wordpress site
  19. Getting a person’s username from a wordpress cookie
  20. One time login on 2 different WordPress sites
  21. How to force “remember me” users to login again?
  22. Multiple issues with Ajax login function due to browsers and cookies
  23. Sharing a logged in session with a custom subdmain site?
  24. Get WordPress logged in username from root domain when WP is installed in a subfolder
  25. wp-cron event doesn’t run when custom login API is enabled
  26. Extend Cookie with auth_cookie_expiration not working
  27. Opening WordPress on wordpress.example.com, while the webpage is at example.com
  28. Custom login method appears to ignore auth_cookie_expiration
  29. Why deleting/removing cookies in WordPress does not log me out from admin?
  30. Cookies error during first time login attempt
  31. Single sign on to sub-sites in Multisite Network
  32. Opening protected page with cookie?
  33. WordPress Cookies – wp_set_auth_cookie
  34. Why doesn’t the “Remember Me” checkbox work for me on a live website? Only works on a local server environment
  35. How to remove without touching the pluggable.php the wordpress_logged_in cookie to show the username on login?
  36. In Django, how do I know the currently logged-in user?
  37. Can I programmatically login a user without a password?
  38. Is there any way to rename or hide wp-login.php?
  39. How to login with email only no username?
  40. How can I redirect user after entering wrong password?
  41. Increase of failed login attempts, brute force attacks? [closed]
  42. Separate registration and login for different roles
  43. SSO / authentication integration with external ‘directory service’
  44. Preventing session timeout
  45. How reduce wordpress login session timeout time?
  46. How to prefill WordPress registration with social details
  47. Check for correct username on custom login form
  48. Disallow user from editing their own profile information
  49. I can’t access my site via wp-admin
  50. ‘Password field is empty’ error when using autofill in Chrome
  51. How to show ‘login error’ and ‘lost password’ on my template page?
  52. What is $interim_login?
  53. How to share cookies and sessions between domain and subdomain?
  54. Custom login form
  55. How to prefill the username/password fields on the login page
  56. wp_signon returns user, but the user is not logged in
  57. Adding extra authentication field in login page
  58. Prevent wp_login_form() from redirecting to wp-admin when there are errors
  59. Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
  60. wp_signon() does not authenticate user guidance needed
  61. What exactly is ReAuth?
  62. What are the differences between wp_users and wp_usermeta tables?
  63. wp_set_auth_cookie() doesn’t work in Ajax call
  64. Login members using web services
  65. Make my wordpress blog remember my login “forever”
  66. How to check in timber if user is loggedin?
  67. How do I change the language of only the login page?
  68. Disable WordPress 3.6 idle logout / login modal window / session expiration
  69. Stop WordPress from logging me out (need to keep me logged in)
  70. Woocommerce registration page [closed]
  71. How to disable autocomplete on the wp-login.php page
  72. Share login data/cookies between multiple installations
  73. Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU
  74. How to pass users back and forth using session data?
  75. How do I change the logo on the login page?
  76. Why does WordPress hide the reset password key from the URL?
  77. Is it possible to sign in with user_email in WordPress?
  78. How to use current_user_can()?
  79. Avoid to load default WP styles in login screen
  80. WordPress registration message
  81. How to fake a WordPress login?
  82. how to display the wordpress login and register forms on a page?
  83. Does wp_logout_url() destroy a session? (Logging out question)
  84. How can I send a welcome email to a user AFTER they login for the first time?
  85. Can not login with correct username and password
  86. Website Visible only to Registered users
  87. How can i increase the login expiration length?
  88. How do I use add_action from a class method?
  89. How to remove the WordPress logo from login and register page?
  90. How can I add a custom script to footer of login page?
  91. Brute force attack?
  92. Customize wp_new_user_notification_email()
  93. Need to execute a cron job
  94. Login email after registration never sent or received
  95. How can I create a separate blog that is private?
  96. How to keep always logged in development environment
  97. Add Confirm Password field in wp-login.php Password Reset page
  98. Integrate recaptcha and wp_signon – what is needed?
  99. Stop users from logging in from multiple locations
  100. I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
Categories login Tags cookies, login, subdomains
get_post_meta does not work
How do I show a button only on my custom template page?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress