DEV Community

Subham Saurav
Subham Saurav

Posted on

Need help for deleting a WordPress Cookie with setcookie() Not Working

I'm currently working on a WordPress plugin where I've set a cookie on the front end using PHP's setcookie() function. However, I'm encountering an issue when trying to delete the cookie using setcookie($cookie_name, '', time()-3600, '/'). It doesn't seem to work as expected, and the cookie persists. Can someone please help me understand what might be causing this problem and how to properly delete the cookie?

Top comments (0)