Search code examples
wordpresscookiesmultisite

Cookies persist after logout - wordpress


I am working on wordpress multisite website. It has three sites for eg: example.com , site1.example.com, site2.example.com. When I login to example.com, it gets redirected to site2 and automatically logs into site2. But when I logout of the site2, the cookies still persist. Like in the below image.

enter image description here

When I again login to the site2 by clicking on signin, It doesn't gets login, and I can see two cookies like in the below image.

enter image description here

One of the cookie's value is empty and when I delete it, I can access my profile without login into the site2 again.

I tried to remove the cookies while logout using wp_logout hook, but it didn't worked.

Theme : buddyboss


Solution

  • I have worked around this and found a solution. In my case adding the below line in wp-config.php file worked.

    define('COOKIE_DOMAIN', '');