wordpress

  • Style variations are theme.json fragments in styles/

    6.0 in May reads every JSON file in styles/ as an alternative set of settings and styles, merged over the base. The merge is deep, so a variation…

  • Rendering a block template in a test

    A block theme has no PHP for a unit test to call, and the nearest equivalent is rendering the template and asserting on the markup. go_to sets the…

  • Testing a block theme without a browser

    A theme with no PHP has nothing a unit test can call, and the only test is a person looking at a page.

  • A theme.json schema check in CI

    A typo in a theme.json key is silently ignored, which means a setting that does nothing looks exactly like a setting that works. The published schema is versioned…

  • useBlockProps applies the class the editor expects

    API version 2 moves the block wrapper from the editor into the block, which means the editor markup and the front-end markup can finally match. Forgetting the call…

  • wp_safe_remote_get, and the SSRF you did not consider

    wp_remote_get fetches any URL it is given, including one on the local network, and the safe variant blocks private ranges. The attack is a URL parameter pointing at…

  • A block theme is a directory of HTML files

    5.9 on 25 January, and templates/ replaces the template hierarchy. A theme with 41 PHP templates and an editor that cannot see any of them.

  • blockGap, and the margin you stopped writing

    Vertical spacing between blocks moves from a stylesheet rule to a setting, which is a better mechanism and a large diff. Setting blockGap to false disables the control…

  • index.html is the only required template

    A block theme needs style.css, templates/index.html and nothing else, which makes the minimum viable theme three files. The fallback to index.html is total rather than partial, so a…

  • theme.json v2 renamed the keys you just learned

    Version 2 arrives with 5.9, six months after version 1, and moves several keys — a file written in 2021 needs migrating. The customTemplates and templateParts sections are…