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

Why is my staging subdomain not sending wordpress_logged_in cookies?

I noticed that the staging environment had different content in its wp-config.php and .htaccess files. I changed them to be closer to the ones on the live environment.

While I was there, I noticed that some of the differing content was related to various caching plugins that we previously had installed on the staging environment. In desperation, I reinstalled all of those plugins through wp-admin and then uninstalled them.

Surprisingly, that fixed the issue of the cookies not being sent. However, the cookies had incorrect paths or domains. After some trial and error, I finally got it working by adding these seven lines to wp-config.php:

define('ADMIN_COOKIE_PATH', '/wp-admin');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', "https://wordpress.stackexchange.com/");
define('SITECOOKIEPATH', "https://wordpress.stackexchange.com/");
define('DOMAIN_CURRENT_SITE', 'test.example.com');
define('WP_HOME','https://test.example.com');
define('WP_SITEURL','https://test.example.com');

My assumption is that one or more of the caching plugins hadn’t cleaned up after itself when we uninstalled it.

Related Posts:

  1. How to save generated JWT token to cookies on login?
  2. Login cookies set as wrong domain
  3. WordPress Admin login redirect to homepage
  4. Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
  5. How to resolve these findings from security audit
  6. ERROR: Cookies are blocked due to unexpected output – no access to FTP
  7. Login with OpenID, similar to Stack Exchange sites?
  8. How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
  9. Keep one user logged for a year?
  10. Disable saving comment details (name, e-mail) in cookie?
  11. Pushing changes from localhost to live server?
  12. Security error WP 4.0 + WP phpBB Bridge [closed]
  13. Which hook should be used to validate custom form fields on the login form?
  14. How to create custom LOGIN and REGISTRATION forms?
  15. Detecting $_GET parameters from any page + Cookie
  16. Prevent Brute Force Attack
  17. Login with email (WP Modal Login)
  18. Check if the front end user is log in or not
  19. How to create a word press user with hashedpassword
  20. Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
  21. Set cookie then immediantly refresh the page
  22. Automatically adding post and pages to new blog setups
  23. Use WordPress with a custom OAuth2 provider
  24. WordPress login with Phone Number [closed]
  25. Cannot access wp-admin after disabling all plugin
  26. Force [wordpress_social_login] shortcode to display where it is embedded [closed]
  27. Do We Need to Validate, Sanitize, or Filter Simple Numerical Superglobals (Cookies and Post)?
  28. Two (or more) looks, with one set of content
  29. Single central login for front end users from any site
  30. How to delete Passwrd Protected posts cookies when a user logged out from the site
  31. Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
  32. “Request has expired” with “Make your site social” (Gigya) plugin
  33. WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
  34. User Session and Stored Cookies not get removed
  35. Where does the cookie mo_page_views_counter come from?
  36. Migrating hosts, 500 errors and plugin issues
  37. How to handle cookies from a WordPress plugin on a cached page?
  38. Redirect to another page using contact form 7? [closed]
  39. How to use login_redirect with a user capability
  40. Login Customizer doesn’t change the background of the register form
  41. easy steps to make front end form without plugin
  42. Change wp-login to custom URL login page
  43. Login problem after installing my written plugin [closed]
  44. Too many login attempts
  45. Get ‘Headers already sent’ error for the plugin I am creating when I try to login
  46. Custom Login Page — wp_signon Headers Already Sent?
  47. Theme My Login Shortcode Doesn’t Return Anything
  48. Displaying content based on drop-down menu selection sitewide
  49. Possibility to login without password
  50. Best way to salvage a very old WP site
  51. WordPress unable to write files in the server
  52. Blurry images when loading the page first time
  53. If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
  54. login in wordpress using gmail account
  55. Janrain/Simple Modal under Redirected Domain
  56. Cookies set by a plugin in wordpress for tracking
  57. Codeless random token generation to pass into multiple tracking links in a single page load
  58. Linking form to user meta fields
  59. WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
  60. Plugin or ways to limit number of users logging in the website,
  61. Identify User Language, Redirect to the corresponding page and Save the chosen language as Cookie
  62. Cookie value changes back to previous value after changing
  63. Display value of the GET parameter in a new URL page
  64. Merging new theme and plugins from development site to production
  65. Which membership plugin for a simple sign in? Personal areas for customers
  66. Discern a specific plugin’s action hooks
  67. Block Google tracking on refuse consent of the user with plugin
  68. Login/password protected “client page”
  69. On button click, redirect users to registration page instead of another page
  70. How can I show login popup when user clicks on download button
  71. How to show private pages based on a user’s role?
  72. How can I store user preferences in WordPress and retreive them later?
  73. Image paths wrong after migrating with wp-migrate-db-pro media files add-on
  74. Implementation to count page visits of unique visitors based on a cookie
  75. admin-ajax.php not working properly on subdomains
  76. How can I save cookies to members
  77. wp_login_form() ignoring login_form action hook
  78. Auto-login from backend
  79. Plugins effecting layout & login
  80. wp-admin will not redirect to wp-login.php
  81. Migrating site from stage to production server without particular dev. plugins?
  82. Adding google authenticator and use only email address of user
  83. Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
  84. set cookies for my whole site is not working
  85. how to protect wordpress website
  86. WordPress ReAuth =1 Loop with wpCAS
  87. HTTP Error 403 When Trying to Login
  88. Advice on setting up private site
  89. Checking url from plugin [duplicate]
  90. What plugin(s) are best for this User registration task? [closed]
  91. Trouble Removing Plugin [closed]
  92. Change All Login/Signup Links in Plugin
  93. How do I to override login redirect on specific pages?
  94. plugin for different writers [closed]
  95. Undefined constant error in pluggable.php
  96. How to create a custom wordpress plugin for a specific functionality?
  97. WordPress Homepage Login
  98. I cannot login after installing the wp-login timeout setting plugin
  99. Issue: Unable to Access WordPress Admin and Database Errors
  100. Custom Login and Password Reset for BuddyPress Website
Categories plugins Tags clone-site, cookies, login, plugins, staging
Print terms with taxonomy and metabox value
Unable to disable Gutenberg with plugin Classic Editor or Disable Gutenberg

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