Wordpress LScache Plugin: Token in wpforms
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi We have litespeed and wpforms on > 1,600 sites. On the pages with contact forms, wpforms have a data-token that gets regenerated every 2-3 days. Our cache ttl is set to 7 days. Is there a way in litespeed we can specifically exclude just that token from getting cached without knowing which page it will appear on? Example: We know wpforms have provided a way to extend the token via functions.php but Im wondering if theres a way to do it via litespeed. It actually doesnt seem to break as often as wed expect it to. Could litespeed be purging pages after a contact form is submitted? Thanks. Could litespeed be purging pages after a contact form is submitted? Yes, LiteSpeed is able to do that, but there is more than 1 way to do that. Add code below to your .htaccess. Not tested, but should work: RewriteCond % REQUEST_METHOD ^POST$ RewriteRule ^/?contact/ - [E=cache-purge:/contact/] or use purge api https://docs.litespeedtech.com/lscache/lscwp/api/#purge with wpforms_process_complete hook Sorry I should clarify as few things. As we have so many sites, we have no reliable way to know which pages have a contact form. So excluding all the contact form pages from being cached via url isnt an option. I had been wondering if submitting a contact form already automatically triggered a purge. I tested it there myself and it does, which would explain why the problem doesnt come up very often. wpforms_process_complete hook is a good option thanks, Ill probably try it with wpforms_frontend_output_before though as a purge seems to happen on successful contact forms anyway. @flagship890 FYI: LiteSpeed cache is a URL based fullpage cache. Without any URL it would not work, but basically you are right. A form must not be purged or excluded from being cached if it is send with POST method. POST requests are automatically excluded from being cached. wpforms uses POST, but seems to have any script support and in this case cache plugin doesnt recognize it. You must not check each installation if it has a form or not. Add the code regardless if any form exists. The code only works if there is a form like wpforms. Nothing goes wrong if there is no form. Thanks for your help. Im going to look into the litespeed crawler or reducing our TTL way down.
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference