WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Polylang NOT compatible with Quick Cache (unless the cookie name is changed) (4 posts)

  1. JS Morisset
    Member
    Posted 1 year ago #

    FYI - Quick Cache does not cache pages with there are any wordpress_* cookies. Since you use wordpress_polylang, Quick Cache will not cache the page.

    May I suggest making the cookie name configurable in wp-config.php with a contant?

    For now, I've had to modify the code.php file like this:

    // set a cookie to remember the language. check headers have not been sent to avoid ugly error
                            if (!headers_sent() && (!isset($_COOKIE['polylang']) || $_COOKIE['polylang'] != $this->curlang->slug))
                                    setcookie('polylang', $this->curlang->slug, time() + 31536000 /* 1 year */, COOKIEPATH, COOKIE_DOMAIN);
    
                            if (!headers_sent() && isset($_COOKIE['wordpress_polylang']))
                                    setcookie('wordpress_polylang', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);  // unset the old cookie - jsmoriss 2013-01-18

    I've modified the cookie name everywhere else as well, but removing the old cookie is also very important. ;-)

    Thanks,

    js.

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

  2. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Quick Cache does not cache pages with there are any wordpress_*

    Do you know the reason for this?

  3. JS Morisset
    Member
    Posted 1 year ago #

    Polylang uses a "wordpress_polylang" cookie. Quick Cache assumes that any "wordpress_*" cookies means the user is logged in, or has left a comment, etc., and disables the cache. So, in effect, Quick Cache is disabled for any website using Polylang.

    The modification above shows a different cookie name, and additional code to remove the old "wordpress_polylang" cookir.

    I'd suggest making the cookie name configurable with a constant in wp-config.

    Thanks,

    js.

  4. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    I will make two things in v1.0:
    1. make the cookie name configurable with the constant PLL_COOKIE
    2. rename the default cookie from 'wordpress_polylang' to 'pll_language' for which the conflict probability should be lower.

    Of course, I will keep backward compatibility: the old cookie name will be recognized by Polylang and replaced at first visit after Polylang 1.0 will be activated.

    You can already test the development version (1.0dev16, for test only, not suitable for production site)
    http://downloads.wordpress.org/plugin/polylang.zip

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.