Modify cache file output or Create multle cache manually




Wordpress LScache Plugin: Modify cache file output or Create multle cache manually

Last Updated on: Wed, 15 Apr 2026 00:00:02
So, i wonder if i could modify the cache content before outputting it to browser?? I have a dark mode feature on my site, so in order to make it smoother i have to toogle the body class dark-mode () via backend. Right now im using vary. but i think there is some other way with a more good result. Even if i really have to save multiple cache for this to work, can i manually generate it and save the dark-mode version cache when visitor visit a normal page? so i just have to modify the normal page content and then save it as a vary dark-mode cache. Hi @foundbutlost, may I know the reason why you need to create multiple caches? Is the dark-mode using fully using a different set of HTML/CSS code or it is just a class change? If the dark mode code different is not too large I suggest you using JS to add the class to the body instead of making two cache copy. Could you please provide?your Report Number, found in?WP Admin > LiteSpeed Cache > Report for us to understand more about your situation? If im using JS, it would not going smooth and resulting bad experience to user. There is a flashing white for a sec if im using js. There is way by just using JS, but cache would ruined it. I dont have any report number as for now. as i said i was just wondering if there is a way to modify the cache content before output it to browser. Currently, you can not edit the cache file and duplicate another cache manually on WordPress level. So the method you are using(create separate cache by vary) is the only way to prepare two caches. If you want to pre-warm the cache before user browses, you can use the crawler cookies simulator(LiteSpeed Cache > Settings > Crawler > Cookie Simulation) to create two versions of the cache. Yes, i have all the server access. I own my server. is it possible to do it through PHP script? You can put the cookies of dark mode on LiteSpeed Cache > Settings > Crawler > Cookie Simulation. And then run the LiteSpeed Cache Crawler.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference