Title: Plugin and COOKIE_DOMAIN
Last modified: February 15, 2024

---

# Plugin and COOKIE_DOMAIN

 *  Resolved [oddjobs](https://wordpress.org/support/users/oddjobs/)
 * (@oddjobs)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/)
 * It seems the plugin doesn’t respect the COOKIE_DOMAIN environment variable. In**
   wp-config.php** it is possible to set the following;
 *     ```wp-block-code
       define( 'COOKIE_DOMAIN', '.. domain name ..');
       ```
   
 * My understanding is that there is an expectation of plugins using this environment
   variable when setting cookies. For example, if this is set for “domain.name”,
   then any site that is available as “domain.name” or “**www**.domain.name” will
   share the same set of cookies.
 * As it stands this seems not to be the case, so I’m finding the plugin confirming
   on one domain, then not making the resulting cookie available to the other domain.(
   which has the potential to break compliance?)
 * There seems to be a very simple solution, in **class-frontend.php**, line # 264,
   if you replace **get_cookie_domain()** with **COOKIE_DOMAIN ? COOKIE_DOMAIN :
   get_cookie_domain()**, then everything seems to work as expected.
 * Is there any chance this change could be incorporated? Also, is there any way
   to submit PR’s? I would have done this if the code were on Github, but I can’t
   seem to find the Repo?
    -  This topic was modified 2 years, 3 months ago by [oddjobs](https://wordpress.org/support/users/oddjobs/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-and-cookie_domain%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17440421)
 * Hi [@oddjobs](https://wordpress.org/support/users/oddjobs/),
 * Greetings from CookieYes!
 * Sorry that we couldn’t change this in the plugin, as it will affect other users.
   We will check for a custom solution for you, so please share your site health
   information privately via [this link](https://www.cookieyes.com/support/).
 *  Thread Starter [oddjobs](https://wordpress.org/support/users/oddjobs/)
 * (@oddjobs)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17440499)
 * Ok, so if the environment variable is not set for a user, it won’t affect them.
   If it is set, it’s set because the user wants cookies to be handled on a specific
   domain. Alternatively, you could add a new environment variable like “COOKIE_YES_DOMAIN”.
 * How will this affect other users?
 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17442013)
 * Hi [@oddjobs](https://wordpress.org/support/users/oddjobs/),
 * Please try the below code snippet to change the domain of the cookieyes-consent
   cookie:
 *     ```wp-block-code
       add_filter(
           'cky_cookie_domain',
           function() {
               return "domain.name";
           }
       );
       ```
   
 * Make sure that you replace the “domain.name” with your respective domain.
 *  Thread Starter [oddjobs](https://wordpress.org/support/users/oddjobs/)
 * (@oddjobs)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17442270)
 * Hi [@cookieyesteam](https://wordpress.org/support/users/cookieyesteam/),
 * I’ve inserted that at the end of my config.php, seems to do the trick!
 * Many thanks!
 *  Plugin Support [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * (@cookieyesteam)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17453321)
 * Hi [@oddjobs](https://wordpress.org/support/users/oddjobs/),
 * This thread has been inactive for a bit, so we are going to mark it as resolved
   now. Please feel free to open a new thread or follow-up if you have any further
   questions or still need help.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Plugin and COOKIE_DOMAIN’ is closed to new replies.

 * ![](https://ps.w.org/cookie-law-info/assets/icon.svg?rev=3007243)
 * [CookieYes – Cookie Banner for Cookie Consent (Easy to setup GDPR/CCPA Compliant Cookie Notice)](https://wordpress.org/plugins/cookie-law-info/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-law-info/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-law-info/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-law-info/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-law-info/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-law-info/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [CookieYes Team](https://wordpress.org/support/users/cookieyesteam/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/plugin-and-cookie_domain/#post-17453321)
 * Status: resolved