Title: Polylang Cookie
Last modified: September 22, 2020

---

# Polylang Cookie

 *  [supportneeded9](https://wordpress.org/support/users/supportneeded9/)
 * (@supportneeded9)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/polylang-cookie/)
 * I read the documentation and have found the php code to implement a filter to
   set the cookie expiration.
 * I want to set the default expiration to “session” to comply with GDPR rules (
   since there is no way for me to block pll_language cookie before consent — Polylang
   creates cookie through php, not script).
 * I used the following php filter:
    `add_filter( 'pll_cookie_expiration', function(){
   return 0; } );`
 * The filter works, however, when expiration is set to 0, the cookie never gets
   set — maybe it expires immediately instead of being set to “Session”?
 * What should I do?
 * Edit: A thing comes to my mind — maybe the pll_cookie_expiration sets the “max-
   age” instead of “expires” which makes it expired immediately.
 * Things to refer to: [MDN — Cookie Attributes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Attributes)
    -  This topic was modified 5 years, 8 months ago by [supportneeded9](https://wordpress.org/support/users/supportneeded9/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/polylang-cookie/#post-13450148)
 * Hello,
 * Could you please open a GitHub issue? [https://github.com/polylang/polylang/issues/new](https://github.com/polylang/polylang/issues/new)

Viewing 1 replies (of 1 total)

The topic ‘Polylang Cookie’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [cookie](https://wordpress.org/support/topic-tag/cookie/)

 * 1 reply
 * 2 participants
 * Last reply from: [Chouby](https://wordpress.org/support/users/chouby/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/polylang-cookie/#post-13450148)
 * Status: not resolved