Article suggestions
  1. Home
  2. Section: Developer Hub
  3. How to Clear and Remove User Cookies on Specific Web Pages

How to Clear and Remove User Cookies on Specific Web Pages

How to Clear and Remove User Cookies on Specific Web Pages
  • avatar
Written by Chan Nier
Updated on February 19, 2025

 Link: https://support.brilliantdirectories.com/support/solutions/articles/12000098261

Warning: 
Cookies are important in knowing when a user is logged in and other important website functionality. So use this code with caution.

As an example, let's say the claim_listing cookie was stored as a user was attempting to claim a member listing.

In order to remove this cookie and stop the ability for the visitor to claim the listing as they continue to browse the website, you can include the snippet of code below on landing pages or web pages where you will not want the claim_listing cookie stored anymore.

<?php setcookieSameSite("claim_listing","", time-36000, "/", $_SERVER['HTTP_HOST'], true, true, "Lax"); ?>

Adding this code snippet on a widget will then clear and remove the claim_listing cookie.


Thank you for leaving a rating!
Did you find this article helpful?
0 out of 0 people found this article helpful so far
Can't find what you're looking for? Get in touch
How can we help?
Send your question below and we'll get back to you as soon as possible.
Cancel
translation missing: en.kb.default.contact_form_error
×
Thanks for your message!
Thanks for your message!
×