Wordpress LScache Plugin: Private caching not working on home page
Last Updated on: Wed, 15 Apr 2026 00:00:02 I apologize in advance that this will be a long description/question! A website I am working on will allow users to register and login, at which time their menus will change to allow access to additional pages. Not only will the main menu change, but there will be certain sections of the home page that also change to include a welcome user message plus some additional links available to them. My intention in the long run is to look into using ESI to separately generate the menus and conditional text on the home page. But for now, I thought I could accomplish the same result using the private caching capability for logged-in users. Unfortunately, it is not working 100%. It works fine on every page except the home page. When a user logs in, the home page they see remains the same. The menu is unchanged as are the conditional text portions of the home page. Looking at the headers returned, I see a x-litespeed-cache: hit for the home page, but x-litespeed-cache: hit,private for all other pages. It seems like the plugin is not recognizing that the user is logged in on the home page. One point (which might be a red herring): One of the text blocks on the home page is a login form. After a login, the user is redirected back to the home page and the login form is replaced by the welcome user message. So I would think the plugin would detect that the user was logged in at this point. What would cause the plugin to not detect that the user was logged in on just the home page? And, am I misunderstanding how private caching works for logged-in users ? should all pages be cached? Thanks as always for your help! Hi, Jlahm Hmmm. Thanks for all of the details. I understand the issue, but Im not sure offhand why its behaving that way. Can you share the URL to your site so I can take a look, and a copy of the environment report so I can see what settings you have enabled? (Visit LiteSpeed Cache > Environment Report) Thanks! Hi Jlahm, Do you mind to try set home page as a private page? See this picture. https://i.imgur.com/OvKUDfw.png Simply add by access home page, click litespeed button, mark this page as private page. Let us know if it works or not. Best, Eric Im sorry Eric if Im a little dense, but I cant find that button or those options anywhere. When I go to the WP Dashboard and edit the home page (or any page), then the only LiteSpeed icon I see is in the top WP menubar and it says LiteSpeed Cache Purge All . Hi, jlahm You shouldnt be in the WordPress Dashboard to do it. Visit your home page, and then press the admin bar button. You should see the options then. Hope this helps Ah, the WP admin bar that I have hidden on site pages? I went into the WP Dashboard in Chrome and enabled the WP Admin bar. In a separate Firefox browser, I then logged into the sites home page as usual. The problem with the menu and content not being changed still occurred, and the WP admin bar was not visible. I went back to the WP Dashboard in Chrome and clicking on the Visit Site link to view the sites home page. Here the WP admin bar did show up (which is interesting?), so I marked the home page as Private Cache. I then went back to the Firefox version and refreshed the home page and now things look great ? the WP admin bar is present, the sites menu is changed as expected, and the home page content is changed to reflect the logged-in user. I hope this provides a clue, and a potential work-around for me by marking the page as private cache. Unfortunately, that means the home page isnt cached for users until they visit the page. Did you clear the cache after you changed the admin bar settings? Its possible the Firefox instance was looking at an old cached copy, and that is why it didnt look any different when you first went there. When you changed the page to Private in the Chrome instance, that would have cleared the cache, making is show up fine in Firefox the next time you visited. I think it should be fine now, but let us know if you run into any more issues! As a quick follow-up, I now find that the login works and the WP admin bar, home page text and menus are changed once I marked the home page as private cache . But, now when I logout I have the opposite problem ? I still see the logged-in version (with changed menus and text and the WP admin bar). Looking at the HTTP headers, it says x-litespeed-cache: hit, private . Clearing the browsers cache does then allow me to see the proper non-logged-in version. However, I did find that if I tell LiteSpeed to not cache the cookie PHPSESSID then everything appears to work correctly. Thanks for your patience! No problem at all! Happy to help My gut tells me that excluding PHPSESSID from cache could have the effect of excluding many otherwise cacheable pages. There is probably a better way? Clearing the browsers cache does then allow me to see the proper non-logged-in version. This makes me think that you may have your browser caching the full page, when it should only be caching static content (like images, JS, CSS, etc). To verify whether this is happening, you can take a look at your .htaccess file and look for the following text: ExpiresByType text/html If it has a value other than 0, then your browser is caching the full page, and overriding LiteSpeeds cache. If you dont see that, but you do see ExpiresDefault That, too, can cause the same problem. Heres a wiki page that describes the issue in more detail, and how to fix it. If this isnt the issue, and you want to pursue this further, you can provide the site URL and an environment report (LiteSpeed Cache > Environment Report), and we can troubleshoot a bit. An update. I did not have the ExpiresByType text/html or ExpiresDefault set. Setting them to 0 had no effect and the problem continued. However, I think I have resolved the problem. As I had noted before, deleting the PHPSESSID cookie or setting it to not be cached did fix the problem. But as you noted, that likely had side-effects. I was using PHP Sessions which is why the PHPSESSID cookie exited. I installed the WP Session Manager plugin which handles session information outside of the PHP session manager and changed my code to use it instead of PHP sessions. Everything is working nicely now. Thanks again for your patience and your suggestions! Knock on wood I think things are good ? for now? I do greatly appreciate the prompt and helpful support Ive always received from the A2 support staff. Oh, good, I am glad to hear that you solved the problem! Thanks for coming back to share the answer, too
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference