{"id":19006867,"date":"2026-08-30T18:18:12","date_gmt":"2026-08-30T18:18:12","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/cache-for-logged-in-users-pt-2\/"},"modified":"2026-08-30T18:18:12","modified_gmt":"2026-08-30T18:18:12","slug":"cache-for-logged-in-users-pt-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/cache-for-logged-in-users-pt-2\/","title":{"rendered":"Cache for logged in users pt. 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi Uzair, thanks again for such a great plugin! I&#8217;ve been keeping it up to date on several websites and it works like a charm.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8216;miss&#8217; in the headers. I could see the logged in pages being generated in the \/easyopt folder, and the pages were being continuosly overwritten.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the fix AI suggested (&#8220;The runtime writer (<code>EasyOpt_Cache::has_excluding_cookie()<\/code>) already skips the auth cookie when\u00a0<code>cache_logged_in<\/code>\u00a0is on; the drop-in was missing that same guard.&#8221;), starting at line 129:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;...]<br \/>if ( ! empty( $easyopt_cfg&#091;'exclude_cookies'] ) ) {<br \/>    \/\/ (2.5.3) When logged-in caching is ON, the auth cookie is the KEY<br \/>    \/\/ (role-varied filenames), not an exclusion. Mirror the runtime's<br \/>    \/\/ EasyOpt_Cache::has_excluding_cookie(), which skips wordpress_logged_in_<br \/>    \/\/ in that case. Without this, a logged-in visitor's own auth cookie<br \/>    \/\/ matches the wordpress_logged_in_ exclusion pattern below and the<br \/>    \/\/ drop-in hard-MISSes before it ever reaches the role-cookie detection.<br \/>    $easyopt_li_cache_on = ! empty( $easyopt_cfg&#091;'cache_logged_in'] );<br \/>    foreach ( $easyopt_cookies as $easyopt_cn ) {<br \/>        if ( $easyopt_li_cache_on &amp;&amp; 0 === strpos( $easyopt_cn, 'wordpress_logged_in_' ) ) {<br \/>            continue;<br \/>        }<br \/>        foreach ( $easyopt_cfg&#091;'exclude_cookies'] as $easyopt_cookie_pat ) {<br \/>&#091;...]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I tested this fix on a live site and now I get &#8216;hit&#8217; for pages when logged in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hope that helps!<\/p>\n","protected":false},"template":"","class_list":["post-19006867","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19006867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19006867\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19006867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}