• Resolved denisgomesfranco

    (@denisgomesfranco)


    Hi Uzair, thanks again for such a great plugin! I’ve been keeping it up to date on several websites and it works like a charm.

    However today I noticed something while doing some checks. Even though the cache for logged in users option is enabled, logged in users were still not getting the cached page and were getting a ‘miss’ in the headers. I could see the logged in pages being generated in the /easyopt folder, and the pages were being continuosly overwritten.

    So I asked AI for help and it found out that even though the cache for logged in users setting is being written to the advanced-cache.php file, the plugin is also adding the wordpress_logged_in_ cookie as an exclusion rule, and this results in the plugin generating and saving the pages but no logged in user would receive them, since everyone logged in has a wordpress_logged_in_ cookie set and the advanced-cache.php file seems to bail early when it finds this cookie.

    Here’s the fix AI suggested (“The runtime writer (EasyOpt_Cache::has_excluding_cookie()) already skips the auth cookie when cache_logged_in is on; the drop-in was missing that same guard.”), starting at line 129:

    [...]
    if ( ! empty( $easyopt_cfg['exclude_cookies'] ) ) {
    // (2.5.3) When logged-in caching is ON, the auth cookie is the KEY
    // (role-varied filenames), not an exclusion. Mirror the runtime's
    // EasyOpt_Cache::has_excluding_cookie(), which skips wordpress_logged_in_
    // in that case. Without this, a logged-in visitor's own auth cookie
    // matches the wordpress_logged_in_ exclusion pattern below and the
    // drop-in hard-MISSes before it ever reaches the role-cookie detection.
    $easyopt_li_cache_on = ! empty( $easyopt_cfg['cache_logged_in'] );
    foreach ( $easyopt_cookies as $easyopt_cn ) {
    if ( $easyopt_li_cache_on && 0 === strpos( $easyopt_cn, 'wordpress_logged_in_' ) ) {
    continue;
    }
    foreach ( $easyopt_cfg['exclude_cookies'] as $easyopt_cookie_pat ) {
    [...]

    I tested this fix on a live site and now I get ‘hit’ for pages when logged in.

    Hope that helps!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Uzair

    (@uzairwp)

    We’ve fixed the issue in the latest version. Please update to the latest version and let us know if you continue to experience any problems.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.