Wordpress LScache Plugin: How to prevent this thing from being Cached or to be in Cookie
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hello, There seems to be some sort of issue while using the LS Cache Plugin. We are using it in optimal settings (as suggested by Hosting provider, which is running on LS Servers) I used a code snippet to show the Total number of Views (text of views changed to Likes in snippet) on each product page (in child themes functions.php file) I found that the code is working correctly. That is the Page Views or Likes updates or increases on every Page Refresh while Im being logged in (and for every logged-in user) However, when I tried to visit the page as a guest user or visitor, it shows the Total Views for that currently moment, and only once. Upon further Refresh of the same page (just like we are doing with as an Admin), the Views or Likes are NOT increasing or changing (means, not updating the way they were doing, for a logged-in user) Reason ? As why the View Counter is updating for Logged-in User- For that, we explored further and found that, we have Set the Settings of Cache > Cache tab > Cache Logged-In users to OFF Due to this, it is correctly working for Admin (or any logged-in user). That is logical. Means, that it is NOT getting cached for logged ? In user. And hence, it might not be getting updated for a Guest User or visitor. So, just wanted to know, how can we EXCLUDE just that thing (Total View Counts), from being Cached for Guests or Visitors. (Logged-out users) In order to have it work properly and shows correct updated results of Total View Counts One of such product page for your reference is below https://www.vasangini.com/product/pink-tapestries-trident-mandala-bohemian-tapestry-queen-bedspread-free-ship-us/ (PS: This can be checked on any other product too) You can see the number of LOVES (below Add to Cart button), with a heart icon. This is what we are referring to. You can try to replicate at your end by following below approach- 1. Once you open the page. Keep note of the number that is displayed to you, for the first time. Then Hit refresh or refresh the page (either desktop or mobile). You will find the number will remain the same and will NOT increase or change. PS: Try to check results by refreshing the page 5-10 times or more 2. Then try to replicate the same as a logged-in user. And then Hit the Refresh or refresh the page multiple times. You will find that the counter will increase with every page refresh. 3. Now that it has been confirmed (or will get confirmed), can you please suggest the Rule or Class to add in the Exclude section or some other way. In order to resolve this. Please suggest some details. Also, in which Exclude section, I have to add that specific rule or Class or code. And if it requires some other way, then please do suggest that. Kindly suggest and resolve PS: If you require the Code Snippet, the please suggest where shall I post that securely or privately. Regards The page I need help with: https://www.vasangini.com/product/pink-tapestries-trident-mandala-bohemian-tapestry-queen-bedspread-free-ship-us/ Hi, You have created a ticket already , please do not double post same thing over multiple platforms Best regards, Hello, The support person did not replied over there since last 2+ days. Hence, had to post here. I am afraid, you people are quick enough to find out the similar post, but not quick and humble to respond to actual post and issue. Thanks Hi, well , sorry about that during the weekend. and yes , they are cases like this , but each case has its own different causes/solutions and unfortunately , for this kind of case, there is no one-fit-for-all solution Best regards, Hello, I received a response there, but with NO solution. Can you please look into the query and check into my response, mentioned in the very first post of this thread. As this issue is related to just the Cache, so there must be some sort of solution to be used under Cache Plugin and your team should have some better idea on this. Atleast some workaround, so as Not to get this thing Cached. Or what needs to be Excluded, or what rule or URI requires to be added in the Exclude section. Would appreciate if you could please take a look into this and help to resolve it. Regards Hi, yes , I have seen this kind of thing multiple times , and this is a typical issue for any cache plugins the cache plugin on wordpress system is doing cache PER PAGE , as it takes one page as one cache unit , one un-dividable unit , so you can not just (easily) want to have the entire page cached except the certain part of it , like post view numbers you have 2 options, one is to use ajax call , this will update the numbers after page is rendered via ajax call , even pages HTML code is already cached. another option , you can ESI , Edge Side Include , this will make use to make certain block of page into a sub-request and update it in real time , but this will require certain custom coding. example and detail: https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url ajax way is more efficient in such case for post view counter update. what needs to be Excluded, or what rule or URI requires to be added in the Exclude section. thats what I mentioned in above , ajax call wont be cached , and ESI request can also be separately controlled to no-cache exclude the URI will be essentially same effect as you turned off the cache as the number shows up in all your product pages. I would suggest you try this https://wordpress.org/plugins/remoji/ it has ajax call , and only output number alone , you can do little customization to make it love number to fit your case. Best regards,
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference