divi5-builder
ASecurityBuild or edit Divi 5 pages on any WordPress site via the WP REST API — using native Divi 5 modules so pages stay editable in the Divi visual builder, with a custom-HTML "code" module fallback. Use whenever the user wants to create, build, edit, redesign, or lay out a page/section/hero/pricing/landing page on a Divi WordPress site (any site running Divi 5), set a page as the homepage, insert sections/rows/columns/modules, upload images to the media library, or "build a page from this design br...
- 3 stars
- 0 votes
- 3 copies
- 10 views
- Added September 19, 2026
Works with
Security analysis
100/100Pro scans all 11 files and shows the line behind each finding
npx -y skills add doughoseck/divi5-builder --agent claude-codeAre you the author of divi5-builder?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/doughoseck-divi5-builder)---
name: divi5-builder
description: >
Build or edit Divi 5 pages on any WordPress site via the WP REST API — using
native Divi 5 modules so pages stay editable in the Divi visual builder, with
a custom-HTML "code" module fallback. Use whenever the user wants to create,
build, edit, redesign, or lay out a page/section/hero/pricing/landing page on a
Divi WordPress site (any site running Divi 5), set a page as the
homepage, insert sections/rows/columns/modules, upload images to the media
library, or "build a page from this design brief". Handles credentials from
the shared .web-creds.txt securely. Trigger even if the user just says "add a
section to the site", "update the homepage", or names a site + a page change.
Secondary, site care (read references/site-care/README.md first): audits the media library and uploads folder of ANY WordPress site (Divi
or not): unused media, orphan files, what is taking disk space. Use for "clean
up the media library", "the site is too big", "what can we delete before the move".
Also updates plugins, themes and WordPress itself on ANY WordPress site, with page
checks before and after: use for "update the plugins", "what is out of date on
<site>", "run the updates", "update WordPress".
argument-hint: "[site] [what to build] (e.g. mysite 'a pricing section')"
allowed-tools: Bash, Read, Write, Edit
---
# Divi 5 site builder
Create and edit Divi 5 pages through the WordPress REST API. Divi 5 stores pages
as WordPress block markup (`<!-- wp:divi/* -->`), so you build a page by writing
that markup into `content` and POSTing it. This skill gives you a **spec → markup
compiler** (`scripts/divi.js`) and a **secure REST client** (`scripts/wp.js`) so
you rarely touch raw markup or credentials directly.
Default strategy (agreed with the author): **native modules first** — real
`divi/section/row/column/text/heading/button/image/blurb/icon-list` modules that
stay fully editable in the visual builder. Fall back to a `divi/code` module only
for a section whose layout the native set can't express.
And **design system first** (the recommended way to build, see the next section):
colours and presets exist BEFORE the first page, and a page carries content and
placement, not design.
## Design system first — the recommended way to build
A site built module by module ends up with the same yellow button styled fifteen
times. Changing it means fifteen edits, and moving it onto presets afterwards is a
project of its own (`references/divi5-globalize-site.md` is what that cost). Build
the other way round:
1. **Look at what the site has:** `node scripts/wp.js <site> design-system`.
2. **Create what is missing, before any page** (mu-plugin >= 1.8; on a new site run
`node scripts/ds-live-test.js <site> all` once first):
- one global colour per real colour: `wp.js <site> ds-color-set --label "Brand" --color "#112233"`
- one preset per repeating look: each button style, each section style (background
+ padding), the heading block, the card: `wp.js <site> ds-preset-set --file preset.json`
- what EVERY module of a type shares (heading case, body colour) belongs in that
type's DEFAULT preset, not in a named one.
3. **Reference them in the page spec.** Any section, row, column or module takes
`"modulePreset":"<id>"`:
```json
{"sections":[{"modulePreset":"sectionidaa","rows":[{"columns":[{"modules":[
{"type":"text","html":"<h1>Title</h1>","modulePreset":["textdefault","titleidaaa"]},
{"type":"button","text":"Book now","url":"https://…","modulePreset":"buttonidaa"}
]}]}]}]}
```
A module on a preset carries **content and placement only** (text, url, image,
margin, alignment). No colours, no fonts, no padding next to a preset.
The compiler follows this: on a module with a preset it leaves out its own style defaults
(a button's 700 weight, left alignment and icon off; a blurb's icon placement; an icon's 40px
size and white colour; a divider's line setting). What the spec sets explicitly is still
written, and then overrides the preset, so only set what the preset must not decide.
4. **Need a look that no preset has?** Used once: set it on the module, with global
colours. Used twice: make a preset. Never copy a preset's values onto a module.
**Rules that are easy to get wrong** (each one was learnt from a failure):
- **One option group, one owner.** Never give a module a setting from a group its
preset already fills (`sizing`, `spacing`, `border`, a font group…). Divi writes the
module's CSS and the preset's CSS separately, so settings that only work together
(max-width + centring) stop working, and a value identical to the preset's is thrown
away at render. `layout` and `sizing` count as one group.
- **Stacking** `["<default id>","<id>"]` keeps what the type's default preset gives
(needed as soon as that default holds settings, because a module with its own preset
no longer gets the default). It is only safe when the two presets set DIFFERENT
things. When both set the same setting, do not stack: the last CSS rule written wins,
and that differs between a published page and a draft preview.
- **A preset id that does not exist fails silently.** Take ids from `design-system`.
- **A preset is made in a context.** A preset taken from a module inside a block-layout
column (every site converted from Divi 4) behaves differently inside a flex column
(what this compiler builds): a centred max-width block shrinks to its content. Make
presets for new pages from modules built the new way, and look at the result.
- **Proportion.** A small edit to an existing page uses what the site has. Do not
introduce presets for a one-off, and do not restyle a site that was not asked about.
`node scripts/preset-spec-test.js` tests the compiler side of this, no site needed.
## Styling rules — NON-NEGOTIABLE
These come straight from how the author builds; follow them exactly. The point of Divi is
that everything is editable in the builder and re-themeable from one place — inline
CSS and hard-coded per-module values destroy that.
1. **NEVER use inline CSS.** No `style="..."` attributes in any module's HTML
content — ever. It's the hardest thing to find and edit and it defeats the
builder. Module content holds clean **semantic HTML only** (`<h1>`, `<h2>`,
`<p>`, `<ul>`…). Style through **module settings** (the `decoration.*` objects
the compiler emits), never through markup. `scripts/divi.js` enforces this — do
not hand-write blocks that reintroduce inline styles. (The one exception is a
`code` module, which is intentionally raw HTML/CSS; keep those rare.)
2. **Type & colour come from GLOBAL variables/presets, not literals — and DON'T
set what you don't need to.** Reference global colours by gcid name
(`{"color":"gcid-heading-color"}`, `bg:"gcid-secondary-color"`) and global font
families by name (`"Outfit"`). `wp.js <site> design-system` lists the site's palette (colours, variables, presets); `global-colors` only scans which gcids pages already use.
**Critical:** only set a typography prop when it must DEVIATE from the module's
default/preset. Assigning a value — *even one equal to the global default* —
pins it on the module, so when the global/preset changes later, that module
**won't update**. So a body paragraph that should just inherit gets **no**
`family`/`size`/`color` at all (omit them); a heading that only needs a
different weight+colour sets *just* those two, not `family`/`size`. Lean spec =
fewer overrides = the site stays re-themeable from one place. That's the goal.
3. **Layout: fractional flex for rows, CSS Grid for grids** (verified 5.9, updated).
- **Simple content rows → fractional flex (the compiler default).** Columns get
a per-breakpoint `flexType` (1/3 desktop → 1/2 tablet → full phone), ET's
documented native method. Just `{"layout":"1-1"|"1-1-1"|"1-1-1-1", …}` — the
compiler sets the fractions + wrap breakpoints. (`mode:"flexwrap"` = the old
100%-columns+wrap, for dynamic-count reflow.)
- **Unequal columns** use Divi's own "offset" structures: `"2-1"`, `"1-2"`, `"3-1"`,
`"1-3"`, `"3-2"`, `"2-3"`, `"2-1-1"`, `"1-1-2"`, `"1-2-1"`, `"1-3-1"`, `"3-1-1-1"`,
`"1-1-1-3"` (proportions on desktop; Divi's own tablet/phone stacking). The number of
columns must match. An unknown layout is an error (it used to become one column).
- **Card / pricing / gallery / looped grids → CSS Grid.** Put `grid` on the row:
`{"grid":{"cols":{"desktop":3,"tablet":2,"phone":1},"spans":[{"target":"first-child","span":2}]}, "columns":[…]}`. Child-agnostic (add/remove/loop freely).
⚠ a `span` rule does NOT reset on mobile — a spanned item won't collapse to 1
column on phone; avoid spans if you need clean mobile stacking.
- Still never hand-write `1/2`/`1/3` or inline widths — use these spec fields.
4. **Reach for the right native module.** `blurb` for icon+title+text cards
(icon chip via the blurb's Custom-CSS field, not inline), `button` styled via
its settings + global colours, `accordion` for FAQs (never a code module),
`divider` for spacing. A common trick: an invisible `divider` (line off, fixed
height) holds a column's height so a **column background image** can `cover`
the space — set `bgImage` on the column instead of using an image module.
**Cards = a styled column**, not a wrapper div: set `background`/`padding`/
`radius`/`border` on the column, and `hover` (`{borderColor, shadow:{blur}}`)
for a hover lift — hover states serialize under a `hover` key beside `desktop`.
A history, roadmap or "our story" page = the native `timeline` module, whose items can hold other modules
(tags, buttons): `references/divi5-modules-verified.md`, "Timeline module".
5. **Wrap by width, never by typed line breaks.** To make a heading break in a chosen place, cap the module's
max-width (in its preset) so the text wraps by itself; a typed `<br>` forces the same split on a phone, where it
is wrong. Check the break at desktop, tablet and phone widths.
6. **A design mock-up is a map, not the style.** When the user supplies an HTML or image design for a site that
already has its look, take the layout and the content from the design and the colours, fonts, sizes and heading
case from the site's presets. Where the design deviates (normal-case headings, another weight, another colour),
follow the site and say so; let the user ask for the exceptions. Colour part of a line with a utility class
(`references/divi5-presets-variables.md`, "More preset facts"), never an inline style.
7. **Never put an em dash (—) into site content.** In dates, ranges and running text use a plain hyphen
("28 - 30 May 2027", "2007 - 2027"). This holds for content you write and for content you take over from a design
or a brief: replace the em dashes before the page is written. Clients read an em dash as a typing mistake.
8. **A hero heading that can wrap needs a line height near 1.15.** Converted sites often carry 2em on hero titles and
subheadings; it is invisible on one line and looks double-spaced on two. Check with a long title. If the theme
forces a line height on every heading with `!important`, the module setting loses: override it for heroes in the
site CSS (`.et_pb_fullwidth_header .header-content h1 { line-height: 1.15em !important; }`) and set the same value
in each hero so the builder shows what the page shows.
9. **Native Divi 5 before plugins; no Divi 4 compatibility mode.** When a plugin only exists to do something Divi 5
now does (sliders, carousels, popups, grids, image hover), rebuild it natively and retire the plugin. A native
rebuild may improve on the original; first find out what the old one does when clicked or hovered on the LIVE site.
A page that still renders through the Divi 4 compatibility layer is unfinished.
10. **Custom code has two homes.** CSS goes in Divi's own Custom CSS boxes (module, row, section, layout, or Theme
Options for site-wide rules), never in a code snippet. PHP and JavaScript go in named, human-readable WPCode
snippets ("Site Name what it does (PHP)"), never in the child theme, Theme Options Integration or a Code module.
One exception: response headers on a site with a page cache go in `.htaccess` (the cache serves pages without PHP).
11. **Never hard-delete; the user does.** Trash pages and posts, quarantine media, write SQL for the user to run after
a backup; switch plugins off rather than delete. Permanent deletes are the user's step, listed for them.
12. **Every staging change is a written, re-runnable step.** On a staging-then-live project, record each change the
day it is made (what, where, the script, how to check it) in the project's go-live playbook, and write content
changes as scripts that refuse to run when the page is not what they expect. Go-live is a replay of that list.
Lessons from Divi 4 to Divi 5 upgrades (migrator bugs, image descriptions, headings, Library items, old row classes,
caching, Yoast and Gravity Forms over REST): `references/divi5-upgrade-lessons.md`.
## Prerequisites — required before you can do anything
Do not start building until **all three** are true for the target site. Confirm
them first (step 2 below checks them); if any is missing, stop and tell the user
exactly which — building without them produces a page that can't be written,
renders broken, or is in the wrong format entirely.
0. **The site must be on Divi 5.** This skill emits Divi 5 **block** markup
(`wp:divi/*`); **Divi 4 uses `[et_pb_*]` shortcodes — a totally incompatible
format**, so building on a Divi 4 site produces garbage. Check with
`node scripts/wp.js <site> divi-check` → must report `verdict:"divi5"`. If it
says `divi4`, STOP — the site needs upgrading to Divi 5 first.
1. **Access details in `~/.web-creds.txt`** — a `[site]` section with
`url`/`user`/`pass` (a WordPress **Application Password**). No creds → no API
access at all. `node scripts/wp.js <site> whoami` must return 200 + your name.
2. **The `divi5-builder` plugin (2.0.0 or later) installed & active on that site**
(source in `plugin/divi5-builder/`; the user uploads `divi5-builder.zip` from the GitHub
release in Plugins → Add New → Upload Plugin and activates it, or copies the
`divi5-builder/` folder (from the zip) plus `divi5-builder-loader.php` (a separate file
in the same release; `plugin/mu-loader/` in the repo) into `wp-content/mu-plugins/` by
FTP; never both. On multisite it must be network-activated (or active on the main site)
for the switches to be reachable. Updates are manual: upload the new zip over
the old one. `node scripts/build-plugin-zips.js` builds the zip and the loader into `dist/`. Old sites
still running the four single-file plugins: the old files are in `assets/legacy/`,
security fixes only until 2027-01-31; installing the new plugin takes over from them.
Page building is always on; Media audit, Media clean-up and Updates are switches in
Settings > Divi 5 Builder, off by default.) This is what makes
a page actually render as Divi — without it you can POST block content but you
**cannot** set the `_et_pb_use_builder` flag (protected meta; core REST drops
it and Divi's own routes reject app-password auth with `invalid_nonce`), so the
page stays a non-Divi sidebar page. Confirm with
`node scripts/wp.js <site> whoami` **and** a probe write: if `set-builder`
later reports the meta "did NOT stick", the plugin isn't active — installing it
is a one-time step per site. **A new site needs BOTH set up before first use.**
## Credentials — handle exactly like this
Site credentials live in `~/.web-creds.txt` (INI: `[site]` sections
with `url`/`user`/`pass`; `pass` is a WordPress **Application Password**).
- **Never** print, echo, log, or hardcode the password — not in chat, not in a
script, not in a tool argument, not in output. `scripts/wp.js` reads the file
at runtime, builds the auth header in memory, and only ever prints results.
Always go through it; never read the raw pass yourself into the transcript.
- Site name is the section header (`mysite`, `staging`, `anothersite`). Confirm
which site if ambiguous.
## Workflow
1. **Identify the site and intent.** Which `[site]`? New page, or edit an
existing one? Get the design brief (or the site's own design skill, if there
is one, for colours, fonts and voice).
2. **Check BOTH prerequisites + detect the site's format (do this first):**
```bash
node scripts/wp.js <site> whoami # prereq 1: 200 + your name = creds OK
node scripts/wp.js <site> divi-check # prereq 0: verdict:"divi5" (STOP if "divi4")
node scripts/wp.js <site> check-plugin # prereq 2: pluginActive:true = Divi mode possible
node scripts/wp.js <site> list-pages # find target page ids/status
node scripts/wp.js <site> builder-version # use this builderVersion in the spec
node scripts/wp.js <site> global-colors # only scans which gcids pages already use (palette: design-system)
```
If `whoami` fails → creds missing/wrong (see Prerequisites). If `check-plugin`
reports `pluginActive:false` → stop and have the user install
`divi5-builder.zip`; you can build block content but the page won't
render as Divi until it's active.
3. **Set up the design system first** (see "Design system first" above):
`node scripts/wp.js <site> design-system` shows the colours and presets the site
has. For a new build, create the global colours and the presets the design needs
BEFORE writing a page, then reference them. For an edit, use what exists: if a
gcid clearly matches the role you need, reference it via `{"colorVar":"gcid-..."}`.
Only when the site has no matching global and you may not add one, emit the literal
hex from the brief with `{"color":"#RRGGBB"}`. When unsure of a gcid's actual hue,
read it from `design-system` — a wrong global is worse than a right literal.
4. **Author a page spec** (compact JSON) rather than raw block markup. The spec
shape and every module type are documented in the header of `scripts/divi.js`.
Quick reference:
- Sections carry `background` (`color` / `colorVar` / `image`+`gradientOverlay`)
and `padding`. Rows carry `layout` (`"1"`,`"1-1"`,`"1-1-1"`,`"1-1-1-1"`, or an
unequal one such as `"2-1"`) and `columns`. Columns carry `modules`.
- **Any section, row, column or module** also takes `cssId` / `cssClass` (Divi's "CSS
ID & Classes": `"cssId":"contact"` makes `#contact` anchors work) and `hideOn`
(`["phone"]`, `["tablet"]`, `["desktop"]` or a mix: hidden on just those devices).
- Image `frame` (`radius`, `shadow`, `border`, `maxWidth`) and `align` style the IMAGE
itself, so rounded corners really clip the photo.
- Modules: `heading`, `text` (HTML), `button` (`text`+`url`), `image`
(`src`+`alt`+`id`), `blurb` (`title`+`html`+`icon`), `iconlist`
(`items`+`icon`), `code` (raw HTML/CSS fallback), and `raw` (escape hatch to
emit any `divi/*` block with hand-written attrs).
- Set `builderVersion` to what step 2 reported.
- For anything native can't do, use a `code` module — it's a first-class Divi
module, not a hack, and renders reliably.
5. **Compile and preview locally:**
```bash
node scripts/divi.js compile <spec.json> --out content.html --site <site>
```
Read what it prints, it is part of the result:
- `WARNING: unknown key "colour" on the button module … (did you mean "color"?)`: a key no builder reads,
so it did NOTHING. Fix the spec. `--strict` makes it an error.
- `--site <site>` checks that every global colour, design variable and preset the page uses exists (and is
active) on that site: a missing id renders nothing, silently. Use it whenever the spec references ids.
- `lint:` the catalogue lint runs on the result when `catalog/catalog.json` exists (block names, option
values, nesting, and image groups in the wrong element). `--no-lint` skips it.
6. **Write to the site.** Default to a **draft** first when building something new,
so you can verify before it's public:
```bash
node scripts/wp.js <site> create-page --title "..." --content-file content.html --status draft
# editing an existing page instead: read it (prints its "hash"), change it, write it with that hash
node scripts/wp.js <site> get-page <id> --out current.html
node scripts/wp.js <site> update-page <id> --content-file content.html --expect-hash <hash>
```
Publishing, or changing an existing live page, is a visible change — get the
user's OK before flipping a page to `publish` or editing a live page.
**Content writes are stale-guarded** (`update-page`, `update-post`, `update-canvas`, like `tb-set`):
they need the hash of the read the change was based on, and refuse with **exit 3 "STALE"** when the
page was saved since. **On STALE: STOP and ask the user.** Tell them which page, and when it was last
saved (the message says), and ask whether someone has it open in the Visual Builder. Do not retry, do
not loop, do not move on to other writes on that page: the builder keeps the page in the browser and
its next save writes the WHOLE page, wiping any REST change made meanwhile, even one that went through.
Only when the user confirms it is saved and closed: read it again and redo the change on top of
theirs, once. Never reach for `--force` to get past STALE: that overwrites their work. `--force` is
for a replace the user explicitly asked for. Every content write first keeps what it replaces in
`~/.divi5-builder/backups/<site>/` (`WP_BACKUP_DIR` to change), and prints the new `hash` for the next
write. `md5` of `get-page --raw` is the same hash, so a script can compute it from what it read.
Opening a page in the Visual Builder and saving it, even with no changes, changes its hash (the builder
reformats the markup, not the content), so STALE after a builder save is expected: the rule stays, stop and ask, then re-read.
**Changing one part of an existing page: `scripts/blocks.js`.** Never rebuild a hand-tuned page to change
one section. Read it, change only the block you mean, write it back with the read's hash; everything
else stays byte for byte (the tool proves it and refuses rather than guess):
```bash
node scripts/wp.js <site> get-page <id> --out page.html # note the "hash"
node scripts/blocks.js tree page.html # addresses: 3, 3.2.1.4, labels, #ids
node scripts/divi.js compile new-section.json --out new.html # the new part, from a spec
node scripts/blocks.js replace page.html --at "label:Featured Work" --with new.html --out page2.html
node scripts/wp.js <site> update-page <id> --content-file page2.html --expect-hash <hash>
```
Also `before`, `after`, `append` (as last child), `remove`, `get`. An address is a path counted from 1
(`3.2.1.4` = section 3, row 2, column 1, module 4), `label:<admin label>` or `#<css id>`; a label or id
that matches two blocks is refused. What goes in must be the same kind as where it goes (a module where
a module was); `--from 1.1.1.1` takes one block out of a compiled page.
7. **Flip the page into "Divi mode" (essential — do this for every page you build).**
Writing Divi blocks into `content` is NOT enough on its own: a page only
renders as Divi (full-width, no theme sidebar, module CSS enqueued, "Divi"
badge in the Pages list) when it carries the meta `_et_pb_use_builder = on`.
Without it the theme wraps the page in its default sidebar template and the
modules look unstyled/broken.
```bash
node scripts/wp.js <site> set-builder <id> # layout defaults to no-sidebar
node scripts/wp.js <site> set-builder <id> --layout et_full_width_page
```
**Prerequisite (one-time per site):** these are protected `_et_*` meta that
core REST won't write and Divi's own REST routes gate behind a cookie-session
nonce (an Application Password can't satisfy it). So the site must have the
`divi5-builder` plugin installed (`divi5-builder.zip`), which exposes those meta
keys to REST behind an edit-capability check. If `set-builder` reports the meta
"did NOT stick", the plugin isn't installed or active — point the user at `divi5-builder.zip`.
Verify what's set with `node scripts/wp.js <site> page-meta <id>`.
8. **Verify it renders (don't just trust the POST).** Confirm the blocks
round-tripped and Divi rendered them as native modules:
```bash
node scripts/wp.js <site> get-page <id> --raw # blocks preserved?
node scripts/wp.js <site> rendered <id> # real Divi HTML, no leaked <!-- wp:divi comments
```
Rendered output should contain the actual text/module wrapper classes
(`et_pb_section` etc.) and none of the literal block comments. If block
comments leak into the rendered HTML, the markup was malformed — check escaping
and nesting against `references/divi5-format.md`.
9. **Homepage (only if asked).** `node scripts/wp.js <site> set-homepage <id>`
sets `show_on_front=page`. This changes the live front page — confirm first.
`reset-homefront` reverts to the blog index.
10. **Report** the page id + link and what you built. Offer next edits.
## Images
Reuse a media URL already in the library when you can. To add a new one:
```bash
node scripts/wp.js <site> upload-media <path/to/img.png> --alt "description"
```
It prints `{id, url}` — put the `url` in an image module's `src` and the `id` in
`id` (Divi likes both). Get the user's OK before uploading their files anywhere.
## Popups (Divi 5 Canvas + Interaction)
> Note: for video/lightbox popups the author usually prefers a dedicated popup **plugin**
> — don't default to building one. The Canvas approach below is a proven,
> plugin-free capability; offer it, but only build it when the user actually wants
> a native Divi popup.
>
> **Self-hosted (.mp4) video popup with autoplay-on-open:** neither the Canvas nor a
> YouTube-only popup plugin can do this — a self-hosted clip needs a native
> `<video>` + a `video.play()` call fired from the user's click (a user gesture,
> so it plays *with sound*; page-load autoplay would be blocked). Use the ready
> reusable snippet **`assets/video-popup-snippet.html`** (a WPCode "HTML Snippet",
> Site-Wide Footer). It's generic: any element with `data-tsm-video="<mp4 url>"`
> (optional `data-tsm-poster`) opens+autoplays it; on a Divi 5 button set that via
> Advanced ▸ Attributes and link the button to `#`.
A Divi 5 popup is a separate **Canvas** (an `et_pb_canvas` post) triggered by an
**Interaction** on a button — fully reproducible over REST. Pattern:
1. **Compile the popup canvas** — a full-screen hidden overlay section:
```bash
node scripts/divi.js compile-canvas <popup-spec.json> --out popup.html
```
`popup-spec.json` = `{ "targetId":"tourpop", "overlayColor":"rgba(8,32,20,.92)",
"width":"min(1000px,90%)", "modules":[ {"type":"video","src":"...mp4","frame":{...}},
{"type":"icon","unicode":"Q","iconType":"divi","absolute":true} ] }`.
The compiler makes the section hidden-by-default (`disabledOn` all breakpoints),
`position:fixed`, `100vh`, `zIndex 9999999`, overlay bg, `interactionTarget`
= targetId, and click-overlay-to-close.
2. **Create the canvas post:** `node scripts/wp.js <site> create-canvas --title "..." --content-file popup.html`
3. **Add a trigger** on the page: a `button` with `"popup":"<targetId>"`, or ANY module
with `"interactions":[{"trigger":"click","effect":"toggleVisibility","target":"<targetId>"}]`.
On Divi 5.13 every module renders as a trigger (proven live with a `divi/text`;
the trigger attribute comes from the generic module wrapper). On Divi 5.9 only
buttons did, so on an older site use a button or test first. Full list of the 8
triggers and 14 effects: `references/divi5-interactions-canvases.md`.
4. **Link the canvas to the page** (essential — without it Divi won't append the
canvas): `node scripts/wp.js <site> link-canvas <canvas_id> <page_id>`. This
writes the meta the builder uses (`_divi_canvas_parent_post_id` on the canvas +
`_divi_off_canvas_data` on the page). Requires the mu-plugin ≥ 1.2.
5. **Verify:** `rendered <page_id>` should now contain the canvas content (e.g. the
video `src`) appended, plus `et-interaction-target-<targetId>` and the button's
`data-interaction-trigger`.
The link is by meta, not post_parent. One popup per page via `link-canvas` as
written (single `_divi_off_canvas_data` pointer). Full serialization in
`references/divi5-format.md`.
Working on a canvas afterwards: `wp.js list-canvases`, `get-canvas <id> [--raw | --out f]`,
`update-canvas <id> --content-file f --expect-hash <hash from get-canvas>`. A canvas can belong to a Theme Builder header,
footer or body layout exactly as it belongs to a page (same two meta keys, the parent
id is the layout's id), and it only reaches the front end when something in the layout
being rendered targets an element inside it. A canvas on a header is on every page
that header serves: get a nod before writing to it.
## Speed check before you rely on interactions
Interactions are the native way, but on one converted Divi 4 site ANY interaction took every page from ~5s to 14-17s,
because of a per-block cost in Divi 5.13's own front-end block parser (details and the measurements:
`references/divi5-interactions-canvases.md`). Another site showed nothing of the kind. So: time a page (3 loads, use the
3rd) before the first interaction and again after. If it jumps, build popups and toggles on that site as native hidden
sections driven by a few lines of script in a code module inside them (pattern in the same reference), not with interactions.
A page that is slow for a reason you cannot name: the hook profiler, see Site care below.
## Visibility toggles (monthly/annual pricing, "show more", etc.)
Do these **natively with Interactions**, never with hand-rolled JS. Pattern (from
the author's pricing toggle): split the content into **state-A** and **state-B** element
sets; give every toggle-able element a unique `interactionTarget` id; start
state-B elements `disabledOn` all breakpoints (hidden). Provide **two small
control buttons** ("show monthly" / "show annual") — one per state, the inactive
one also `disabledOn`. Each control button carries an `interactions` array with a
`click → toggleVisibility` effect for **every** target class in BOTH sets (incl.
the two controls themselves), so one click flips the whole group. The real CTA
buttons are separate (one per state, with the matching link, e.g.
`?cycle=monthly` vs `?cycle=annual`) and toggle too. `module.decoration`
carries `interactionTarget`, `interactionTrigger`, and `interactions.desktop.value.
interactions[]`; see `references/divi5-interactions-canvases.md` for the exact shape,
every trigger and effect, and how canvases reach the front end. (On Divi 5.13 any
module can be the trigger; on 5.9 only buttons rendered one.)
**Compiler support (use these props — no hand-wiring):**
- Any module: `"toggleId":"<id>"` makes it a toggle **target**; `"hidden":true`
starts it hidden (`disabledOn` all breakpoints) — the "state B" elements.
- A `button`: `"toggles":["idA","idB",…]` (+ optional `"trigger":"<id>"`) makes it a
**control** that flips every listed target on click. Give both control buttons
the **same full target list** (include both controls' own ids so they swap too).
- Cards: style the **column** — `background`/`padding`/`radius`/`border` +
`"hover":{"borderColor":"gcid-…","shadow":{"blur":"18px"}}` for a hover lift.
- **Anti-jump (important):** when you toggle two stacked elements (e.g. the two
CTA buttons, or the two control buttons), put them in their **own nested
row/column with `rowGap:"0px"`** so hiding one doesn't shift heights. In a spec,
nest with a `row` module: `{"type":"row","layout":"1","columns":[{"rowGap":"0px",
"modules":[btnMonthly, btnAnnual]}]}`. Give the control-buttons column `rowGap:"0px"`
too. (A column has one rowGap for all children, so isolate the zero-gap pair.)
A 9-tier pricing toggle was generated this way: each card has
monthly/annual price `text` + a nested `rowGap:0` row holding monthly/annual CTA
`button`s (annual ones `hidden`), each with a unique `toggleId`; two control
buttons carry `toggles` = all 38 ids.
## Prefer native modules — code/HTML is the LAST resort
Build with native Divi modules **wherever you can**, and lean hard toward native
before reaching for a `code` module. Almost everything that looks like it "needs
HTML" doesn't: a pricing table is `blurb`/`text`+`button` cards in flex columns; a
feature grid is blurbs; an FAQ is a native `accordion`; tabs/toggles are the
Toggle/Tabs modules; icon rows are `icon-list`. Pure HTML in a `code` module is
un-editable in the builder, un-themeable from presets, and brittle — treat it as a
genuine last resort for something with no native equivalent (a bespoke SVG
animation, a third-party embed). When you do use one, keep it small and isolated.
**Pitfall (learned the hard way):** never split interdependent JS/CSS across
separate `code` modules. A pricing monthly/annual toggle's `<script>` was bundled
into a *different* section's code module; when that section was later rebuilt
natively, the code module — and the script — vanished, silently breaking the
toggle. Any `<script>`/`<style>` must live in the **same** `code` module as the
markup it drives. Better still: do it natively so there's no loose JS to lose.
(And interactive toggles are exactly the kind of thing to keep native or in a
dedicated plugin rather than hand-rolled JS.)
## Module inventory & data-driven (verified 5.9)
The compiler emits these module `type`s (all verified from live builds; keys in
`references/divi5-modules-verified.md`):
- **Content:** heading, text, button, image, blurb, icon, iconlist, code, video, divider.
- **Native compound:** accordion, tabs, toggle, cta, testimonial, pricing (pricing-tables),
counters (bar), circle-counter, number-counter, countdown, heading-module.
**Pricing: always state `"currency"`** (on each tier, or once on the pricing module), taken from the
SITE: its WooCommerce currency, or the client's country. Not from where the user is: a South African
developer builds UK sites too. If it is unclear, ask. Left out, the compiler uses this computer's
region and prints a WARNING; treat that warning as a missing setting, not as an answer.
- **Batch 2:** hero (`fullwidth-header`, `fullHeight:true` = fullscreen), slider (+slides),
person (`team-member`; image uses `url`), map (+pins), tooltip, timeline (+items),
post-carousel (`fullwidth-portfolio`), group + group-carousel.
- **Layout:** section/row/column; row `mode` fractional (default) / flexwrap; row `grid`.
- **Compound modules are CONTAINERS.** `hero` takes `modules:[…]` and nests them
inside the header, rendering below its own title/content — that is how you put
a linked image or an extra line of copy in a hero (verified live). The tell is
the serialization: a module written with a plain `-->` opener plus a
`<!-- /wp:divi/… -->` closer accepts children; a `/-->` self-close does not.
`dump-blocks` before assuming any module is a leaf. To drop a built-in button,
pass `button1:{text:'',url:''}` — emptying is what the builder itself does.
⚠ `builder-version` reads the FIRST EXISTING BLOCK's stamp, not the installed
Divi, so it goes stale after an upgrade. Both detailed in the format reference.
- **Third-party:** `filtergrid` (Divi Plugins `dp-dfg/filtergrid` — needs their plugin;
requires that commercial plugin). Query-driven CPT grid with built-in content/video
popups + skins; verified props + a raw `settings:{}` passthrough for any option.
**Data-driven (Loop Builder + dynamic content):**
- Put `loop:{ postTypes:["belt"], orderBy, order, postPerPage }` on a **column** or a
**group** → it repeats per queried post.
- Bind fields with the `dc()` helper in any content value: `dc('loop_post_title')`,
`dc('loop_post_featured_image',{thumbnail_size:'large'})` (as image `src`),
`dc('loop_post_excerpt')`, and **custom fields**
`dc('loop_post_meta_key_manual_custom_field',{select_loop_meta_key:'loop_post_meta_key_<key>'})`.
- Common pattern: a `group-carousel` whose `group` has a `loop` + `dc()`-bound modules
(looped CPT cards), or a grid column with `loop`.
**Adding any other module:** build it once in the VB on the scratch page,
run `node scripts/wp.js <site> dump-blocks <id>` to read its exact keys, then add a
builder — 2-minute loop. Don't guess; dump.
## Every Divi module: the catalogue (`scripts/catalog.js`)
The compiler has hand-written builders for the common modules. For everything else
(all 115 modules in Divi 5.13.1, WooCommerce ones included) there is a catalogue
GENERATED FROM THE USER'S OWN COPY OF DIVI: the `module.json` definitions the Visual
Builder itself is built from, plus each module's default attributes and Divi's
Divi 4 → 5 attribute map.
```bash
node scripts/catalog.js build "<path to unzipped Divi theme folder>" # once per Divi version
node scripts/catalog.js list [filter] # every module, its kind, its children / parents
node scripts/catalog.js show <module> # elements, fields, allowed option values, defaults
node scripts/catalog.js find <text> # which modules have a field or option like this
node scripts/catalog.js lint <content.html> # check block markup BEFORE writing it to a site
```
- **No catalogue yet?** Ask the user to download Divi from their Elegant Themes account
and unzip it anywhere; point `build` at the folder holding `style.css`. The catalogue
is derived from Divi (GPL), so it is generated locally and git-ignored, never shipped.
- **Workflow for a module the compiler lacks:** `show <module>` → write it as a `raw`
module (`{"type":"raw","block":"divi/xxx","attrs":{…},"inner":"<child blocks>"}`) →
`lint` → write to a draft → look at it. `show` tells you whether it is a container
and which child block it takes.
- **`lint` errors are hard facts:** unknown module, unknown element, a value that is not
one of a field's options, a child module outside its parent, a foreign module inside a
parent/child container, invalid JSON, unbalanced blocks. It raised ZERO false errors
on 3,333 builder-written blocks across two sites (`--strict` adds soft hints).
- **What it cannot tell you:** the VALUE SHAPE of the shared groups (font, spacing,
background, border, sizing, position…). Those are the same on every module and are in
`references/divi5-format.md`; when unsure, dump a builder-made example.
- **It knows less than Divi accepts.** `module.json` does not declare everything (e.g.
`divi/video` has a real `thumbnail` element it never lists). The catalogue also learns
elements from Divi's conversion map; anything still unknown to it may yet be valid, so
an "unknown element" on a block the BUILDER wrote is a catalogue gap, not a page bug.
- `node scripts/catalog-test.js` plants seven kinds of mistake and fails unless each is
caught and the clean original passes. Run it after touching `catalog.js`.
## Presets and design variables (read `references/divi5-presets-variables.md`)
Styling rule 2 says type and colour come from globals. This is how to find and use them:
- **See what the site has:** `node scripts/wp.js <site> design-system` (mu-plugin >= 1.6,
read-only): every module preset, option group preset, variable and global colour, with
ids. Divi itself offers no way to read these over REST.
- **Use a module preset:** `"modulePreset":["<id>"]` on the block. Omit it (or
`["default"]`) to get the site's default preset for that module. Never copy a preset's
attrs onto the block "to be safe": block attrs override every preset.
- **Use an option group preset:** `"groupPreset":{"<slot>":{"presetId":["<id>"],"groupName":"divi/font"}}`.
The slot is either an attribute path (`button`, `title.decoration.font`) or a composite
id (`designTitleText`); both occur in builder-saved content. `groupName` must be the
preset's own. `catalog.js show <module>` lists the module's elements to pick from.
- **A preset id that does not exist fails SILENTLY** (no error, no styling). Always take
ids from `design-system`, never from another site or from memory.
- **Variables** are `$variable({"type":"…","value":{"name":"gcid-…|gvid-…","settings":{}}})$`.
Colours take `settings` `hue`, `saturation`, `lightness`, `opacity`. Five colours and two
fonts always exist (`gcid-primary-color` … `--et_global_body_font`).
- **Creating or changing them (mu-plugin >= 1.8):** Divi's own save routes replace the WHOLE
store and want a cookie nonce, so never call those. The plugin writes ONE item per call
through Divi's own save functions, add-only, with the previous store kept for restore:
```bash
node scripts/wp.js <site> ds-selftest # FIRST on every site: must say "different: 0"
# (module presets; option group presets too from 1.8.2)
node scripts/wp.js <site> ds-color-set --label "Brand" --color "#112233" [--dry-run]
node scripts/wp.js <site> ds-variable-set --type numbers --label "Gap" --value 20px [--dry-run]
node scripts/wp.js <site> ds-variable-archive --id gvid-x [--dry-run] # delete one variable (>= 1.8.4)
node scripts/wp.js <site> ds-preset-set --file preset.json [--dry-run] [--summary]
node scripts/wp.js <site> ds-backups ; node scripts/wp.js <site> ds-restore --store presets --index 0
```
Same name or label updates, so a script can run twice. **Divi 5.15+ never drops a variable:** it
refuses a store that leaves an id out and "deletes" by setting status `archived`. So on 5.15+ use
mu-plugin >= 1.8.4 (1.8.3 answered `ok:true` to a variables restore Divi had refused); its restore keeps
newer variables archived. Details: `references/divi5-presets-variables.md` section 5.0. `node scripts/ds-live-test.js <site> all`
proves colours, variables, presets and restore on a site and leaves its stores exactly as
they were: run it once per new site (staging, nobody editing). Option group presets
(`"kind":"group"`) are proven for one group (Border on a Text module, against a builder-made
one). For another group, try one module and look at it first. A group preset holds its own
group's settings only; the plugin leaves out the rest and reports it. On a site with
mu-plugin < 1.8, ask the user to make the preset in the builder and read its id.
- **Divi 5.18: variable math, nested variables, mixed text** (section 6 of the reference). In a spec,
`{{gvid-xxxx}}` inside any value is the variable's token and `{{dc:post_author}}` a dynamic-content
token: `"top":"{{gvid-space}} * -1"`, `"html":"<p>By {{dc:post_author}} · {{gvid-copyright}}</p>"`.
Math is `+ - * /` only: `×` renders invalid CSS and the compiler and lint warn about it.
`ds-variable-set --value "clamp( {{gvid-min}}, 4vw, {{gvid-max}})"` makes a nested variable (plugin
>= 2.0.1, which refuses missing, archived, other-type, self and cyclic references), and
`ds-variable-archive` refuses (409) while another active variable still uses the variable.
## Components and Slots, Divi 5.15+ (read `references/divi5-components-slots.md`)
Components are Divi's old Global Elements, renamed and extended in 5.15.0: a saved design in the Divi
Library (`et_pb_layout`, scope `global`) placed on pages as `divi/global-layout` blocks. Any nested
attribute can be unsynced per instance, and a `divi/global-slot` module (a "Slot module", not a preset
slot) holds free-form per-instance content. Sites ported from Divi 4 may already hold them.
- **Look before you write:** `wp.js <site> dump-blocks <id> --tree`; a `global-layout` means Components.
- **Never rebuild such a page from a spec.** Change only the blocks you mean to and keep every
`divi/global-layout` block, with everything inside it, byte for byte.
- **A per-copy value needs two edits on the block that owns the field** (proven over REST on 5.15.1):
the value in that block's attributes AND the full path (e.g. `content.innerContent.desktop.value`)
in THAT block's `localAttrOverridePaths`, for a nested module the nested block, not the outer
`global-layout`. The Component must have the field unsynced ("Make editable on instance"). A value
without its path, or a path for a synced field, does nothing, silently.
- **Placing a copy over REST works:** a self-closing
`<!-- wp:divi/global-layout {"globalModule":"<id as a STRING>","blockName":"divi/section","builderVersion":"5.15.1","localAttrs":{},"localAttrOverridePaths":[]} /-->`
renders the Component as saved. Find ids by exporting from the Components Manager, or from an
existing copy on a page.
- **The shared design lives in the Component, not on the page.** No REST route for Components yet
(Divi's need a nonce): the user edits it in the builder's Component mode or with the Divi AI Agent.
- **`globalize.js` does not reach Components yet** (it reads pages, Theme Builder, canvases).
- Order of a design system: colours and variables, presets, then Components for repeated blocks.
## Globalising an existing site (read `references/divi5-globalize-site.md`)
Moving a site with hard-coded values onto global colours and presets WITHOUT a visible
change is a process, not a command. The reference has the order, the rules and what went
wrong the first time. `scripts/globalize.js` runs each step, dry run by default:
```bash
node scripts/globalize.js <site> inventory # what is pinned, how often
node scripts/globalize.js <site> colors --map map.json [--write] # literals -> global colours
node scripts/globalize.js <site> signatures # preset candidates + examples
node scripts/globalize.js <site> presets-build --defs defs.json # specs + which modules fit
node scripts/globalize.js <site> presets-create [--write]
node scripts/globalize.js <site> presets-assign [--write]
node scripts/globalize.js <site> restore --step presets-assign [--write]
```
Three rules carry most of the weight: assign a preset STACKED on the module type's default
preset when that default holds settings the preset does not set itself; never SPLIT an option group between a preset and a
module (Divi renders their CSS separately, and duplicates on the module are stripped at
render); and prove every step with `assets/snapshot-instrument.js` (before, control,
change, no-op CSS save, warm, diff), because a bulk write that "worked" says nothing about
what a visitor sees.
## Theme Builder: headers, footers, body layouts (mu-plugin >= 1.5)
Core REST does not expose Divi's Theme Builder post types (`et_template`,
`et_header_layout`, `et_body_layout`, `et_footer_layout`), so these commands go
through the plugin. Check it first: `node scripts/wp.js <site> status`
must show `divi5-builder` 2.0.0 or later (or an old `divi5-builder-rest` 1.5.0 or later),
otherwise the user uploads the newest `divi5-builder.zip`.
| Command | Does |
|---|---|
| `tb-list` | Every template and layout: which layouts each template uses, its display conditions, and each layout's FORMAT (`divi5`, `divi4`, `divi5+legacy-shortcodes`, `empty`). `--json` for the full dump. |
| `tb-get <id> --out <file>` | Saves the layout's raw, unrendered content and prints its `hash`. |
| `tb-set <id> --content-file <f> --expect-hash <hash>` | Overwrites the layout. `--dry-run` runs every check without writing. `--mark-divi5` also sets the Divi 5 builder flags. |
| `tb-restore <id>` | Swaps the layout back to what the last `tb-set` replaced. Undoable by running it again. |
**A header or footer is on every page of the site. Treat `tb-set` as a live,
site-wide publish and get a nod from the user first, every time.** The route is
deliberately fussy, and these refusals are working as intended, not bugs to route
around:
- `stale` (409): the layout changed since your `tb-get`, usually because the user
edited it in the Visual Builder. Read it again and redo the change on top of
theirs. Never fetch a fresh hash just to force your old content through.
- `unbalanced_blocks`: the opening and closing block comments do not pair up. The
usual cause is a missing `<!-- /wp:divi/placeholder -->` at the very end (every
stored page has one; `divi.js` before 2026-09-21 left it off), then a cut-off
file. It is a count, not a parse: it does not prove the content is otherwise bad.
- `not_divi` / `empty_content`: the file holds no Divi blocks or shortcodes, or nothing.
Almost always the wrong file.
- `needs_unfiltered_html`: this WordPress user cannot save block JSON intact
(non-super-admin on multisite). Needs a different user, not a workaround.
- `roundtrip_failed`: what got stored does not MEAN what you sent (different blocks,
order, nesting, attributes or text), and the plugin already put the old content back.
From 1.5.1 a save that only re-serialises (`\"` to `"` and so on, see "What a
save does to your content" in the format reference) is accepted and reported as
`reserialised_on_save: true`; plugin 1.5.0 rejected those too. `new_hash` is the hash
of what is STORED, so use it, not the md5 of your file, as the next `--expect-hash`.
**Tests that keep the compiler and the guard honest** (run after touching either):
- `node scripts/roundtrip-test.js <site> <throwaway_draft_id>`: compiles a spec full of
quotes, backslashes, dashes, tags and non-ASCII, writes it, and fails unless the site
stores it byte for byte. Passed on Divi 5.9, 5.13 and 5.15.1. Run once on any newer Divi.
- `php scripts/tree-guard-test.php <wp-includes dir> <sent.html> <stored.html>`: runs the
plugin's own comparison code locally. The pair must match and eight kinds of deliberate
damage must each be caught.
Always finish by loading a front-end page that uses the layout and checking it
rendered (`rendered <page_id>`, or the browser). Layout content is the same block
markup as a page, so `divi.js` output and `dump-blocks`-style reading both apply.
Scope: editing EXISTING layouts only. Creating templates, or changing which pages a
template applies to, means writing `et_template` meta and the master
`et_theme_builder` post's template list. That is not implemented.
Why the plugin calls `wp_slash()` before saving, in case you ever touch that code:
WordPress unslashes post content and post meta on save, and Divi 5 block JSON is
full of `<` style escapes. Tested on 26 real pages: every one is corrupted by
an unslashed write, none by a slashed one.
## Site-wide Custom CSS (mu-plugin >= 1.7)
Divi's Theme Options ▸ General ▸ Custom CSS field looks like a Divi setting but
isn't one — since WP 4.7 Divi redirects it straight into **WordPress core's own
Additional CSS system** (a `custom_css` post per active theme). Divi's own save
route for it rejects Application Password auth the same way Theme Builder does
(`invalid_nonce`, needs a live wp-admin session), and Divi 5's newer theme-options
REST route doesn't cover this field at all — checked its allowlist, `custom_css`
isn't in it. So until mu-plugin 1.7 this field was only editable by hand in
wp-admin.
```bash
node scripts/wp.js <site> css-get # { css: "..." }
node scripts/wp.js <site> css-get --raw # just the CSS text, for piping
node scripts/wp.js <site> css-set --file style.css # REPLACES the site's Custom CSS
node scripts/wp.js <site> css-set --file style.css --append # adds to what's there
```
Use this for styling something a page-level `code` module can't reach — a
plugin's own rendered markup (a Gravity Forms field, a WooCommerce widget) that
isn't part of any Divi page content, or any CSS the user wants living in the same
place they'd normally paste it by hand. It takes effect immediately (this is
WordPress core's own `wp_head` output, not Divi's builder-CSS static file cache —
no cache to clear here, unlike a page/Theme-Builder write).
**Scope it.** Custom CSS is global — write selectors scoped to the specific
element/form/page you're styling (an id like `#gform_wrapper_9`), not bare tag
selectors that would leak onto the rest of the site.
## Background video and other field notes
- **Background video**: one file per breakpoint, plays on phones, always centre-cropped; and a header dropdown that
closes on a click elsewhere: `references/divi5-modules-verified.md` and `references/divi5-interactions-canvases.md`.
- **Page cache**: writes need a cache clear afterwards. What helped and what did not:
`references/site-care/wp-page-cache-notes.md`. Site search: `references/site-care/wp-site-search.md`.
- **Tool limits**: `upload-media` can be refused (HTTP 413) for files of a few MB, and Theme Builder templates cannot
be created, only their layouts edited. In both cases the user does that one step in wp-admin.
- **A post grid with a popup per post, and a single-post template built from custom fields** (third-party Divi
FilterGrid; Video, Icon and Slider modules fed by ACF fields, each part hidden when its field is empty; an X icon;
big button presets with an always-visible icon): the last sections of `references/divi5-modules-verified.md`.
Writing to a custom post type, its ACF fields or a taxonomy: `wp.js rest-post wp/v2/<route> --data-file body.json`.
- **Restoring deleted sections and bringing old Divi 4 markup in line** (lint snapshots as the oldest copies, the
passes re-run on one page, the leftovers to look for, the `"` quoting trap, header writes that did not
stick): the end of `references/divi5-globalize-site.md`. **A graphics size guide for a client's designer**
(`assets/image-slots-measure.js`): the end of `references/site-care/wp-media-audit.md`.
- **Removing a page and everything that points at it** (snapshot first, the reference sweep over layouts, menus,
canvases, content, CSS; what the tool trashes and what the owner deletes; a Theme Builder template "deleted" in
the UI stays in the database for 7 days; menu entries set to a new tab over core REST):
`assets/page-removal-sweep.js <site> <page-id>` and the last section of `references/divi5-globalize-site.md`.
- **A post type shown as grid cards + popup, fed by ACF** (FilterGrid custom fields on the card, a sold-out badge
without PHP, filters limited to the right terms, the dropdown layout's markup, cards cropped to one shape, the popup
template's hero cap and multi-line fields, ACF "Show in REST" or writes are silently dropped; choosing photos with
`assets/photo-contact-sheet.js`): the last section of `references/divi5-modules-verified.md`.
- **A popup-only post type with no single page** (`assets/wpcode-no-single-page.php`) and **opening an
Interaction-revealed section from a `#hash` link** (`assets/wpcode-open-revealed-section.js`): the end of
`references/divi5-interactions-canvases.md`.
- **Headings that break on a phone:** `assets/phone-headings-scan.js` (paste into the browser console at 375px).
## Abilities (plugin >= 2.1.0 to read, >= 2.2.0 to write content, >= 2.3.0 to manage the site, >= 2.4.0 for maintenance, WordPress 6.9+)
The plugin can offer "abilities" (named, permission-checked actions such as `divi5-builder/posts-list` or `divi5-builder/core-version`) through the WordPress Abilities API. Since 2.2.0 some of them change the site. They are separate from the page-building routes.
- **Master switch, off by default.** While it is off no divi5-builder ability exists, and the call below lists none of them. Only an administrator turns it on in Settings > Divi 5 Builder (each category has its own switch). The USER does that, never a script. Nothing is exposed over REST that flips a switch.
- **Every call is logged (30 days)** and results have secrets filtered on a best-effort basis, so never treat a result as safe to paste anywhere. In 2.1.0 every ability only reads. From 2.2.0 the ones that change things are called writes (below).
- **Writes (2.2.0).** Create, update, trash and restore for posts, pages and custom post types, media, categories and tags, comments, custom fields and menus; restore a revision; Divi section and text edits; the design system and Theme Builder restores. They run only while the master switch AND the category of the thing they change are on, and only for a user who may do it in wp-admin. Every change keeps a full copy of what it replaced in the change history (30 days, Settings > Divi 5 Builder, or `history-changes-list` and `history-change-get`). Undo is done by a person from WordPress's revisions or that copy; there is no revert ability.
- **Site writes (2.3.0).** `settings-set` (title, tagline, date and time formats, start of week, posts per page, comment default; never `siteurl`, `home` or `admin_email`), `settings-set-homepage`, `appearance-theme-mod-set` / `-delete`, `appearance-custom-css-set` (needs `expect_hash` = `custom_css_hash` from `appearance-get`), `widgets-add` / `-update` / `-move` / `-remove`, `cache-flush`, `cron-run` (one scheduled event, as `cron-list` returns it) and, on block themes only, `templates-update` (pass `type` when a template and a part share the id) and `global-styles-set` (as WordPress: send `styles` and/or `settings`; a part left out keeps its stored value, `null` removes it; refused when the stored layer holds a hidden secret-named key, which `global-styles-get` shows as `masked`). The ones that can take a site down are **risky**: a second switch per category ("Also allow risky actions", Settings, Appearance, Site health, Templates), off by default, set by the USER in wp-admin. A risky ability does not exist while its switch is off, and `settings-set` refuses the whole call when any key in it is risky (permalinks, time zone, language, search engine visibility). Every one keeps the previous value in the change history. Example, change the tagline: write `{ "input": { "settings": { "blogdescription": "Fresh bread daily" } } }` to body.json and run `node scripts/wp.js <site> rest-post wp-abilities/v1/abilities/divi5-builder/settings-set/run --data-file body.json`. Read first with `settings-get`.
- **Maintenance (2.4.0): the update loop for phones and AI clients.** `plugins-status` / `themes-status` / `core-status` (what is out of date, from the stored list; `updates-check` asks wordpress.org again), `plugins-update` / `themes-update` (a copy of the folder is kept for 30 days FIRST, then the update, pages checked before and after), `plugins-rollback` / `themes-rollback` with the update's `history_id` (puts the kept copy back, premium plugins included), `core-update` (the exact version on offer; NO copy, a core rollback is a backup restore), `translations-update`. Also `plugins-install` / `themes-install` (wordpress.org slugs only), `plugins-activate` / `plugins-deactivate`, `themes-switch` (an activation or switch that makes the pages worse is reverted at once), deletes with a preview and code (`plugins-delete` runs the plugin's uninstall routine: its data goes for good, `keep_data: true` removes the files only), `users-create` / `-update` / `-password-reset` / `-meta-set` / `-meta-delete` / `-delete-preview` / `-delete` (never a password: WordPress emails its own links; not your own account, not the last administrator, not another administrator's email, no reset for 24 h after an email or role change), `email-send-test` (`to`: `me`, `admin` or `user:<id>` only). Almost all of these need the category's risky switch (Users, Plugins, Themes, WordPress core), which the USER sets; the Email category is separate. Full workflow: `references/site-care/wp-site-updates.md`. **The human check is part of the contract:** every update, rollback, activate, deactivate and switch result carries `human_check`. Pass it on to the user after the run, every time: ask them to look at the site in a browser and on a phone for layout breaks, missing images, console errors, broken forms and raw shortcodes. The page check compares status, error text and size only, so never report the site as fine. On a site below WordPress 6.9 the Updates REST route and `scripts/site-care/site-updates.js` stay the way to update (no rollback there).
- **Updates need the hash.** Read the item first (`posts-get`, `pages-get`, `cpt-get`, `divi-tb-get` ...) and pass the `hash` it returned as `expect_hash` in the update. If the content changed since, the update answers `stale` and writes nothing: read again, redo the change on the new content. After a successful edit the answer carries the new hash. A read that answered `masked: true` (a secret was hidden in it) cannot be written back: the update is refused with `masked_read`.
- **Trash is one step, a permanent delete is two.** `*-trash` and `*-restore` just work. A permanent delete (a term, a menu, a custom field, a media file) first needs the matching `*-delete-preview`, which changes nothing and returns what would go and a `confirmation` code. Show the USER that, and only after they say OK call the delete with the same input plus `confirmation`. The code works once, for the same user, and expires in 10 minutes.
- **List them:** `node scripts/wp.js <site> rest-get "wp-abilities/v1/abilities?per_page=100&page=1"` (follow `page=2`, and so on, until a page comes back short or empty). The list also holds core's abilities and other plugins' (`core/...` and so on); keep the names that start with `divi5-builder/`. With the master switch off there are none from divi5-builder, though the others are still listed.
- **Run one:** WordPress core accepts only a GET for a read-only ability, so use `rest-get`, not `rest-post` (which is for `wp/v2` content routes and cannot reach this route): `node scripts/wp.js <site> rest-get "wp-abilities/v1/abilities/divi5-builder/posts-list/run"`. Input goes in the query string as `input[key]=value`, URL-encoded: `...posts-list/run?input%5Bper_page%5D=5` (a boolean as `true`/`false` or `1`/`0`). An ability the signed-in user may not use answers 403, bad input 400, a missing item 404.
- **Run a write:** core takes a POST for an ability that changes things, with the input in a JSON body, and `rest-post` accepts exactly that route: put `{"input": {...}}` in a file and run `node scripts/wp.js <site> rest-post wp-abilities/v1/abilities/divi5-builder/<name>/run --data-file body.json`. A refusal (403 not allowed, 409 stale, 400 bad input) exits non-zero and shows the site's message. Only a POST to the `run` route of one ability is allowed this way; every other `wp-abilities` route stays GET only.
- **Worked example, change one phrase on a Divi page** (`divi-text-edit`): read the page for its hash, `node scripts/wp.js <site> rest-get "wp-abilities/v1/abilities/divi5-builder/pages-get/run?input%5Bid%5D=42"`, then write the body file
```json
{ "input": { "post_id": 42, "expect_hash": "<hash from the read>", "old": "Open Monday to Friday", "new": "Open Monday to Saturday" } }
```
and `node scripts/wp.js <site> rest-post wp-abilities/v1/abilities/divi5-builder/divi-text-edit/run --data-file body.json`. `old` is the text as a visitor reads it and must occur exactly once (`not_found` lists near matches; `ambiguous` lists the blocks, so repeat with `"at": "3.2.1.4"`; `crosses_markup` means the words span a tag, so shorten `old` or add `"html": true`). The answer holds the new hash and an excerpt, ready for the next edit. Nothing outside the text fields changes.
- **Check a site:** `node scripts/abilities-live-check.js <site>` runs each read-only ability once, GET only, and prints per ability its name, ok or refused or error, the HTTP status and the result's key names and size (never the values), then the newest audit rows. It also checks that `cpt-get` refuses an internal type with 403 and that `divi-design-system` takes `input[full]=true`. Add `--anonymous` to send one GET with no credentials and check it is refused (401 or 403; WordPress gives a logged-out caller 401) and logs at most one row. It says `master off: no abilities exposed` when the switch is off.
- **Try the site writes on a dev site:** `node scripts/abilities-live-site.js <site> settings|homepage|theme-mod|css|widget|cache|cron|history|all` changes one thing per step, checks it by reading, and puts back exactly what it changed (the tagline, a `d5b_live_mod` theme mod, the Custom CSS, a `d5b-live-widget`; `cron` runs `wp_privacy_delete_old_export_files`). `homepage` needs `--page <id>` of a published page titled `d5b-live-...` and `--confirm go` (without it, it prints the plan and exits 3). It prints names, ids, hashes, statuses, durations and byte counts only; exit codes as the write script.
- **Try the maintenance abilities on a dev site:** `node scripts/abilities-live-maint.js <site> plugin|theme-switch|update|user|email|history|all [--item <plugin file>] [--theme <stylesheet>] [--confirm go]`. `plugin` installs `hello-dolly` from wordpress.org, activates, deactivates and deletes it (preview and code) and asserts its kept copy; `theme-switch --theme <folder>` switches and switches back; `update --item <plugin file>` updates and rolls back (or skips with a note when nothing is waiting); `user` creates, resets, re-roles and deletes `d5b-live-user` (reassigning to you); `email` sends a test email to you; `history` checks every write has its row and every update, rollback and delete row its kept copy. Only `hello-dolly` and `d5b-live-user` are ever deleted (exit 2 otherwise); `plugin`, `theme-switch` and `user` print their plan and exit 3 until `--confirm go`. Note: `all --item <plugin file>` runs the real update and rollback of that plugin and sends one test email even WITHOUT `--confirm go` (only plugin, theme-switch and user wait for it). Deactivate WordPress's own `hello.php` first if it is active (activating `hello-dolly` next to it is fatal). A failed update prints the history row of its kept copy (roll back with it); after a failed step the HUMAN CHECK line names what the run changed. It ends with the human check: look at the site.
- **Try the writes on a dev site:** `node scripts/abilities-live-write.js <site> posts|media|tag|menu|divi|history|all` creates, edits, trashes and (with a preview and then `--confirm <code>`) deletes only items named `d5b-live-...`, step by step; `divi` needs `--page <id>` of a copy titled `d5b-live-...`. It prints ids, titles, statuses and hashes, never result values, and exits 0 (passed), 1 (unexpected status or missing history row), 2 (usage or a non-`d5b-live-` target) or 3 (a preview waits for `--confirm`).
## Site care (any WordPress site): media audit and clean-up, updates, go-live, performance
Maintenance tools, not page building. **Read `references/site-care/README.md` before using any of them.**
- Media audit (unused media, orphan files, disk space): `node scripts/site-care/media-audit.js scan|crawl|report <site> --dir D`
- Media clean-up (quarantine, reversible): `node scripts/site-care/media-quarantine.js verify|plan|move|restore <site> --dir D`
- Updates (plugins, themes, WordPress): `node scripts/site-care/site-updates.js status|update|clear <site>`
- Go-live (dev over live) and slow-page profiling: `references/site-care/wp-go-live.md`, `node scripts/site-care/hook-profiler.js gen <dir>` (the USER uploads d5b-profiler.php to wp-content/mu-plugins/ and deletes it afterwards, never you)
- Media audit, Media clean-up and Updates need their switch on in Settings > Divi 5 Builder (off by default, only an administrator flips it; the USER does it, never a script).
- Never hard-delete: you audit and quarantine, the USER deletes. Updates: show the plan and get a go first, and pages are checked before and after each one. The script keeps NO old version; the 2.4.0 abilities keep a copy for 30 days and can roll back (WordPress core excepted), so from a phone or an AI client, and on WordPress 6.9+, use those (`references/site-care/wp-site-updates.md`). Either way, end with the human check: ask the user to look at the site in a browser and on a phone (layout breaks, missing images, console errors, broken forms, raw shortcodes). On STALE (exit 3) stop and ask, as in the Workflow.
## Reference
`references/divi5-format.md` — the Divi 5 block serialization format, exact
per-module content keys, escaping rules, column-structure presets, and a minimal
valid page. Read it if you need to hand-write a `raw` module or debug rendering.
It was reverse-engineered from the pages of a live Divi 5 site and verified by a live
round-trip (build draft → confirm native render → delete), so trust it over
general web docs.
`scripts/vb-resave-check.js`: snapshots a page before and after a Visual Builder save and compares the block tree,
every attribute, the text and the rendered HTML (formatting-only changes are listed apart). The procedure and the
per-release checklist are in `references/divi-release-checklist.md`; the versions checked are in the README table.
## Safety notes
- One shared creds file, many sites — always pass the right `<site>`.
- Prefer draft-first; treat publish, live-page edits, homepage changes, and media
uploads as visible actions needing a nod from the user.
- Clean up throwaway/test pages with `delete-page <id> --force`.
Files in this skill
- .web-creds.example.txt
- CONTRIBUTING.md
- SKILL.md
- assets/divi5-builder-rest.php
- assets/video-popup-snippet.html
- examples/spec.json
- references/divi5-format.md
- references/divi5-modules-verified.md
- references/divi5-research-2026-07.md
- scripts/divi.js
- scripts/wp.js
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.