Start a project
← Build Notes
fix October 25, 2026 · 1 min read

The cache setting that switched off a whole food menu

Excluding a script from LiteSpeed’s JavaScript optimisation sounds safe. On a live ordering site it quietly removed the bag and every Add button.

On a food delivery site, a script was excluded from LiteSpeed Cache’s JavaScript optimisation to stop it being combined with others. It looked like a harmless tidy-up. After the update, the menu still showed, but there was no bag and no Add buttons. Nobody could order.

What actually happened

WordPress plugins pass settings to their scripts with a small inline block of data. LiteSpeed rewrites that block so it loads late, together with the optimised scripts. A script taken out of the optimisation runs early, finds no settings yet, and stops without an error.

The fix

  • Don’t exclude plugin scripts from LiteSpeed’s JavaScript settings. Exclude stylesheets only if stale CSS is the problem.
  • If a script reads settings from the page, have it wait for the page to finish loading when they aren’t there yet.
  • After any cache change, test the one thing that earns money: add something to the bag and check out.

The lesson: a cache plugin changes the order things load in. Test the flow, not just the page.