Support » Plugin: Polylang » polylang always sets cookie

  • Hi
    I was wondering why you were always setting the polylang cookie, it gives me cache hit problems

    Do you think that it is a bad idea to change this code

    if (!headers_sent())
         setcookie('wordpress_polylang',....

    into this one ?

    if (!headers_sent())
      if (!isset($_COOKIE['wordpress_polylang']))
          setcookie('wordpress_polylang',....

    in wp-content/plugins/polylang/include/core.php line 196

    http://wordpress.org/extend/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby

    (@chouby)

    Just because the visitor can switch from a language to another and I need to remember the last language visited. Could you explain what you call “cache hit issue”?

    Thread Starter thibault.ketterer

    (@thibaultketterer)

    Thaks for your quick answer.

    I am using varnish-cache in front of my wordpress to achieve caching of http pages.
    But varnish is not caching if the wordfpress response has a Set-Cookie, cause a cookie is supposed ot be unique to each visitor.

    I was looking for a way to send the Set-Cookie only when it changes or when the visitor does not have one.

    Plugin Author Chouby

    (@chouby)

    I will include this test in v0.9:

    if (!headers_sent() && (!isset($_COOKIE['wordpress_polylang']) || $_COOKIE['wordpress_polylang'] != $this->curlang->slug))

    Thread Starter thibault.ketterer

    (@thibaultketterer)

    nice thanks !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘polylang always sets cookie’ is closed to new replies.