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. Adding extra authentication field in login page
  37. wp_set_auth_cookie() doesn’t work in Ajax call
  38. Make my wordpress blog remember my login “forever”
  39. How to check in timber if user is loggedin?
  40. Stop WordPress from logging me out (need to keep me logged in)
  41. Does wp_logout_url() destroy a session? (Logging out question)
  42. Need to execute a cron job
  43. Login email after registration never sent or received
  44. How to keep always logged in development environment
  45. Add Confirm Password field in wp-login.php Password Reset page
  46. Gaining Login Access via the Database
  47. send users logging in from wp-login.php directly to home page of site, rather than dashboard
  48. Changing Login Logo
  49. How can I retrieve the username and password from my WordPress installation?
  50. User logon by using mobile number [closed]
  51. wp-admin seems to be redirecting
  52. WordPress login urls
  53. Redirect after empty login username and password
  54. WordPress Login page trashed
  55. Are there ways of logging in that bypass wp-login.php altogether?
  56. Customizing the WordPress login form
  57. How to display username and password after registration
  58. wp-login gives 404 error, but wp-admin is working fine
  59. Custom login message for single post pages only
  60. Private page protected with username and password
  61. Password protect media attachment – share across guests
  62. Password reset – Disabled for LDAP accounts
  63. Completely replacing the login form
  64. How I can share cookies from my dimain to subdomain?
  65. Login problems on multisite installation with different domains
  66. Add logout link when logged in, make it disappear when logged out?
  67. Keep user session with custom implementation of user login
  68. Sidebar login widget with error print, returns an error
  69. Temporarily locked out … how long is a “short while”?
  70. Change default login auth
  71. Add html to wp_login_form
  72. Are login functions considered part of the WP backend?
  73. Sign in with social media accounts without creating a WP account [closed]
  74. WordPress login form script
  75. WordPress authentication using custom php?
  76. what is the best and safest way to allow users to register to site
  77. ERROR: Cookies are blocked due to unexpected output (no FTP access)
  78. How do I change the language of the login page to Arabic?
  79. MAMP localhost wordpress site, not possible to sign in, username and password are correct
  80. How to post frontend login form to a different authentication script from wp-login?
  81. Make WordPress User Name be the Company Name when Registering (not the default ‘first name’ last name’ email address’)
  82. Confused – can’t access wordpress dashboard or site that has been published
  83. wordpress login loop and session problem
  84. unable to Login to Admin
  85. WordPress login loop on proxy setup with SSL – Apache proxy to IIS
  86. ERROR: Cookies are blocked due to unexpected output – ultimate solution
  87. Fatal error: Call to undefined function get_plugin_data()
  88. backend access per user status
  89. Make WordPress User Name the Email Address When Register
  90. Users redirected to old site
  91. WordPress Login / SSL = Code Question
  92. Save user login date
  93. I get 404 when I try to login ever since I changed the permalink
  94. wp_signon gives error insufficient_permissions
  95. Is there a way to give users the option to log in to their favorite group on login? [closed]
  96. How to change the login URL
  97. Click on banner to register to the blog
  98. WordPress MU: Cookie error when trying to login on network WP instance
  99. Login and register by API
  100. Log in a user upon password reset?
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

  • Disable image compression for WebP
  • At what stage does wp_ajax hooks gets applied during WordPress request?
  • How to create specific wordpress Table
  • How to get variable from other function inside class function using add_action for Ajax call
  • Some images not loading after changing IP on local wordpress install
  • search posts by POST ID
  • Elementor Contact Form Submit button has empty class
  • Duplicate Slugs on multilingual site (with Polylang)
  • Timeline from diferent wordpress api urls endpoint works, but diferent date
  • $attributes not defined in block.json PHP template for ACF blocks
© 2023 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