Wordpress LScache Plugin: cookies cache
Last Updated on: Wed, 15 Apr 2026 00:00:02 Im new to LiteSpeed Cache. We use WooCommerce along with AffilateWP. AffiliateWP is very dependent upon accurate cookies: affwp_ref ? this cookie stores the affiliates unique ID affwp_ref_visit_id ? this cookie stores the visit ID (the visit ID increments by 1, each time any referral link is used until the cookie expires or is deleted). affwp_campaign ? this cookie will only be stored if an affiliate generates an affiliate referral URL with a campaign name from the Affiliate Area Do I need to add these cookies to Cookies List section in the LiteSpeed Cache plugin settings to prevent them from being cached? If so, would it be something like: affwp_ref affwp_ref_visit_id affwp_campaign Im just not sure how the caching of cookies works yet in LiteSpeed Cache. Thanks for any suggestions. The page I need help with: https://www.healthyhouseclub.com If you want to prevent the cookies from being cached, then, yes, you would add them to the Do Not Cache Cookies list. And you would do it one-per-line, just like you have listed there. Welcome to LiteSpeed Cache Let us know if you run into any problems! Is there a setting to disable caching of all cookies? Maybe Im missing something, but I cant imagine a circumstance where that would ever be needed/appropriate. Thanks for any clarification/suggestions. Can someone tell me if cookies are cached for all users (similar to page cache) or are they cached for individual users (similar to browser cache). Been searching and cant seem to find how cookies work with this plugin. Also, can anyone give an example of when caching cookies might be helpful, and maybe when it should be avoided? Im just trying to understand so I know how to set things up. Thanks for any help. Hi, @andrew55. Cookies and caching can be a little bit complicated, so Im happy to try and explain it further. Can someone tell me if cookies are cached for all users (similar to page cache) or are they cached for individual users (similar to browser cache). Been searching and cant seem to find how cookies work with this plugin. The two types of cache you are referring to are Public and Private. And just to clarify, its not the cookies themselves that are being cached or not cached. Its the pages of the site that are being cached or not cached based on whether a user has those cookies stored. Cookies, generally, are ignored unless you specify otherwise. Cookies become important when they effect the user experience in some way. If a cookie must be set or read by WordPress, then it has to be excluded from cache. So, in the case of your affiliate cookies, if WP is reading those cookies at any time, then they need to be added to the Do Not Cache Cookie as previously advised. And heres something else important: if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookies value. Also, can anyone give an example of when caching cookies might be helpful, and maybe when it should be avoided? This forum post is a good example of a situation where cookies are used to distinguish one type of visitor from another. The cookie is then used to determine which variation of a page in the public cache should be served to that visitor. (Thats called a cache vary and its very useful.) I hope this helps! Let me know if you need any further clarification. In the meantime, Ill update our wiki with this information Thank you very much for taking the time for a thorough explanation. This is so important, as we need our site to function properly. The cookies for our affiliate program merely identify what affiliate should get a commission if the user makes a purchase. They follow the user throughout the site, all the way to checkout. If this is so? Its the pages of the site that are being cached or not cached based on whether a user has those cookies stored. ?If I have the affiliate cookies listed in the do not cache area of the LiteSpeed plugin, when a user arrives on a page from an affiliate link, will this page not be cached for this user? Its important to me to have all users hit cached pages so content (text, images, etc) will load faster, regardless of what cookies they have in their browser. Im sorry to be a pain, but based on what youve clarified, Im not understanding why affiliate cookies should be excluded with the cache settings. What would be the purpose? When you say this? If a cookie must be set or read by WordPress, then it has to be excluded from cache. ?Do you mean that if there is an affiliate tracking cookie, this cookie needs to be excluded from the cache, and as a results of this, no cached pages will show for the user who has this cookie? Will this result in a text, images, etc loading slower? Also, when you say this? if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookies value. ?are you saying I need to disable cache for these pages altogether? So, no text, images, ect can be cached for any users, if a cookie is set from this specific page? Thanks for any clarification for these questions. ?If I have the affiliate cookies listed in the do not cache area of the LiteSpeed plugin, when a user arrives on a page from an affiliate link, will this page not be cached for this user? It will not. Im not understanding why affiliate cookies should be excluded with the cache settings. What would be the purpose? It all depends on how the cookie is processed. If WP needs to read or change the contents of the cookie, the page cannot be cached. A cached page is static. It doesnt invoke PHP at all. But PHP needs to be used if the cookie is manipulated in any way. When you say this? If a cookie must be set or read by WordPress, then it has to be excluded from cache. ?Do you mean that if there is an affiliate tracking cookie, this cookie needs to be excluded from the cache, and as a results of this, no cached pages will show for the user who has this cookie? Yes. Will this result in a text, images, etc loading slower? Yes and no. LSCache is for dynamic content (i.e. PHP). LSCache doesnt cache static content like images in the first place, so they wouldnt be affected by this. Also, when you say this? if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookies value. ?are you saying I need to disable cache for these pages altogether? So, no text, images, ect can be cached for any users, if a cookie is set from this specific page? Yes. All of this makes it sound like its impossible to cache a site that uses affiliate cookies, but I cant say for sure thats true. It really depends on how the plugin processes the cookies. I dont know enough about how the affiliate plugin works to be able to give you a straight answer. If you can tell me a little bit more about how the cookie is originally set, what happens to the cookie while a visitor navigates your site, and what happens when an order is placed, I can probably be more specific. Its possible your site could be set up to use the cookies as a cache vary like in that forum post I linked to earlier. In that case, the pages could still be cached, only those with affiliate cookies would get a different publicly-cached copy of the page than everyone else. But, like I said, its impossible to know without understanding more about the plugin youre using. Ive been on the AffiliateWP site, and according to their FAQ, their system works with cached sites. I didnt dig too deeply, but I did see a reference to JavaScript. If all of the cookie-related tasks are done with JS, then there should not be a conflict with LSCache (and you should not need to exclude anything from the cache). I suggest you contact AffiliateWPs support just to be sure, but if its a 100% JS-based solution, then you dont have to do anything on the LSCache side to make it work. [You do still have to be careful if you are doing any JS optimization (combine/minify, etc.) Make sure you test that thoroughly, because JS/CSS optimization features are not always compatible with every plugin!] Lisa, Thats good news about AffiliateWP. I will check with them to make sure. As far as? LSCache doesnt cache static content like images in the first place ?Im recently switching over to LiteSpeed Cache from W3TC. Maybe Im understanding it wrong, but I believe page cache in W3TC cached images, text, etc, resulting in faster loading speeds. Are you saying that images arent cached (server side) with LiteSpeed Cache? Our site is image heavy and we need to have as many images cached as possible. If not, do you have a suggestion for a compatible plugin for caching images, text, etc. Thanks for any help. Are you saying that images arent cached (server side) with LiteSpeed Cache? Our site is image heavy and we need to have as many images cached as possible. Correct. LSCache is a full-page cache, which means in this case we take dynamically-generated PHP and save it as HTML. Images and other static content, like JS or CSS, are not cached at the server level. W3TC doesnt cache images at the server level, either. If you want to cache images, you need to either use a CDN, or browser cache to store the images locally on the visitors device. You probably had browser cache set up with W3TC, though its possible they didnt call it that. Im not sure. You can enable browser cache with LSCWP in the Settings > Advanced tab. Learn more here. We also have CDN support built-in to LSCache, so if you went that route, you can set it up on the Settings > CDN tab. Learn more here. I hope this is helpful! Lisa, Very helpful. Thank you for clarifying everything. You are welcome! Glad I could help
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference