Skip to content

Index of /2026/07/27/eleven-kilobytes/

2026-07-27 08:16  1.2K

Eleven kilobytes hiding in the head

A minimal classic theme with one template and no assets still produced a 20 KB front page. Almost none of it was the theme.

The head alone was 14.4 KB, and 12.6 KB of that was a single block of CSS custom properties that WordPress generates from its own default theme.json: forty eight colour presets, twenty four gradients, twelve font sizes, seven spacing steps. A theme that uses none of them still ships all of them.

Adding a restrictive theme.json does not remove them. Setting defaultPalette to false does not remove them either, at least not for a classic theme. Dequeuing the global-styles handle does not work once separate block assets are enabled, because the stylesheet is printed later than the dequeue runs.

What does work is the wp_theme_json_data_default filter, which lets a theme rewrite core defaults before they are turned into CSS. Emptying the preset arrays there took the head from 14.4 KB to 3.1 KB. It is a filter core provides for exactly this purpose, so nothing is being removed or overridden that the theme directory guidelines protect.

The remaining 2.3 KB is layout and alignment rules that block content actually depends on. That part stays.

Parent Directory

Index Of/1.0.0 Server at indexof.kbsr.co.jp Port 443