Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

A blank WordPress page caused by one missing hidden input

A client's WordPress rental site had one page that rendered completely blank below the header: the camping-gear rental page. Other rental pages were fine. The cause. The theme's booking script expects every rental page

A client's WordPress rental site had one page that rendered completely blank below the header: the camping-gear rental page. Other rental pages were fine.

The cause. The theme's booking script expects every rental page to have a full checkout block: hidden inputs for the cleaning fee and tax, and a prepayment button. The camping-gear item had no cleaning fee and no tax, so the theme didn't render those elements. The script tried to read them anyway, hit null and threw.

Because the caching plugin combines all scripts into one file, that single error stopped everything after it — including the code that draws the page content. One missing input, one blank page.

The quick fix. Without touching the theme, we added a small snippet (via WPCode, site-wide header) that runs on DOMContentLoaded and, for every .checkout block, adds the missing hidden inputs with value 0 and a hidden prepayment button if they aren't there. The page came back immediately.

The better fix. Daily rental of tents isn't really a "booking with nights", so we then replaced the calendar on that page with a simple price list and a WhatsApp button.

One more lesson. To show the Portuguese version of the price list we first checked document.documentElement.lang — but the theme always outputs en. Checking location.pathname.startsWith('/pt/') worked.

Takeaways:

  1. When one page is blank, open the console first: a single uncaught error can hide everything.
  2. Combined scripts turn a small error into a full outage.
  3. Don't trust the lang attribute on multilingual WordPress sites — check how the plugin really builds URLs.
  4. A patch is fine to stop the bleeding; then fix the product logic.

We maintain small business websites at Weblevo: https://weblevo.com

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.