← back to the pad

Cooking Mode

WordPress plugin — 105 lines that stop the screen sleeping

PHPWordPressWake Lock API

Built
July 2025
Status
Shipped to a client recipe site
Stack
PHP, WordPress plugin API, browser Wake Lock API
Code
Private — happy to walk through it

Problem

You are cooking from a recipe on a tablet propped against the backsplash. Your hands are covered in flour. The screen sleeps between step four and step five, and waking it means touching it.

It is a tiny problem that happens every single time anyone uses a recipe site on a device, which is most of how recipe sites get used. Nobody files a complaint about it; they just quietly get annoyed and reach for a cookbook.

Solution

A WordPress plugin that puts a Cooking Mode button on recipe pages and holds a screen wake lock for as long as it’s switched on.

Worth noting

The whole plugin is 105 lines across one PHP file and one JavaScript file, with no build step and no dependencies. Something this small should be readable end to end by whoever inherits the site, and it is.

The path prefix being configurable rather than hard-coded is the one bit of restraint I’d defend hardest — it’s the difference between a plugin that works on one site and one that works on the next one too.