Support » Plugin: W3 Total Cache » Fragment caching and cookies not working

  • I’m trying to add a box that should be shown until the user ticks it off. I’m using a cookie to determine whether the user has chosen to hide the box and I’ve wrapped the box in mfunc tags to prevent caching – unfortunately, it seems very sporadic whether this works or not (sometimes it seems to work on some subpages, etc.).

    I’m doing something like this:

    <!-- mfunc mysecretcode -->
    if (!isset($_COOKIE["mycookie"])) {
        echo 'the box goes here, <a onclick="jqueryAjaxSetCookie();">click to hide</a>';
    <!-- /mfunc mysecretcode -->

    It works flawlessly when I’m logged in as admin and caching is disabled – as soon as I’m not, it breaks. I’ve verified that the cookie is being set using a cookie inspection addon for my browser.

    Anyone have any ideas? Thanks in advance!

Viewing 1 replies (of 1 total)
  • Temporarily fixed by loading the content via AJAX and adding the URL that is loaded from to the W3TC cache exclude list.

    I consider this a hack and would prefer some working fragment caching, though.

Viewing 1 replies (of 1 total)
  • The topic ‘Fragment caching and cookies not working’ is closed to new replies.