Do not cache blocks or ESI blocks in template ? how?




Wordpress LScache Plugin: Do not cache blocks or ESI blocks in template ? how?

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi all, Ive built an awards platform for a client in WordPress which allows users to register and vote on nominations. I use Litespeed plugin with Redis but parts of the voting functionality on the archive pages and the single nomination pages isnt reflecting the fact that the user has placed a vote. Ive confirmed that this is because of caching by disabling Litespeed which makes it function correctly. The issue is nothing to do with Object caching, disabling Redis only has no effect. Ive been advised that I should look into Do not cache blocks for the relevant bits of my templates or to try ESI, however Ive tried googling for examples and bits of code I might be able to use but cant really find anything suitable. Can anyone give me a few pointers how to go about achieving this? Many thanks Kevin How did you reflect that the user has voted? You can give the page a purge by our API when user is placing a vote. However, if the UI after voted is different than the one before vote but they are same URL, you may need to give the voted users either no cache or a separate cookie (which we called vary) to make it a separate cache. Hi there, OK, just to explain it a little bit more? users have to be logged in to vote, they can register for this after which they get an activation email with a link, once activated they can log in. There are a couple different voting phases, one for staff and one for the general public. General public can register to vote any time, but can only vote during the voting phase but that doesnt start till later this week. The page url in question is something like http://mydomain.com/community-project/ ? this is an archive page which lists out all the community-project post types and at the top of this page is a block which informs the user which project they have voted for, and at what time etc, or if no vote has been cast. Each community project listed has a vote button (which only displays if the user has not voted already) so that users can choose to vote for the project they want to win. Users are only allowed one vote, so once the vote has been cast, the page refreshes and the block at the top now displays the vote information and inserts a button to reset their vote. The vote buttons are also removed from each item in the list. I use a bootstrap modal window for the vote dialogue and some ajax calls which set the relevant meta data on the user and the post. When the vote is cast successfully, the page just refreshes and displays the new voting status according to whether the vote was cast or reset. The site is built using Sage 9 starter theme and uses Theme My Login plugin for user registration/login etc. Hope that explains the scenario a bit more, I do have a staging version of the site which I would be more than happy to provide access to if you think it would help? Much appreciated Kevin Did you try to give the voted users a vary? Hi @the_lar, Im going to mark this topic Resolved, due to lack of activity. You never stated whether you tried to use a vary cookie. Just in case you need to know more about that, you can check out the cache vary documentation and our API. If you still need help, well be happy to reopen the topic.



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



Reference