wp_set_brand_kit
Author/replace the Global Brand Kit and apply the FULL Elementor Theme Style (the active kit) — not just colors: it also writes h1–h6 + body + link + button + form-field + image + layout controls, so the WHOLE site renders on-brand (~130+ kit controls from a compact token set). CHANGES EVERY PAGE — pass confirm=true to apply, or dry_run=true to preview the computed Elementor settings without writing. Plugin transport + Xyle Connector v0.4.0+ required. brand_kit shape: {colors:{primary,secondary,accent,text,bg,border, ...extra named colors}, typography:{heading:{family,weight}, body:{family,weight}, scale:{h1:{size,sizeTablet,sizeMobile,weight,lineHeight,letterSpacing,wordSpacing,unit}, ... , body, small}, links:{color,hover}}, UNITS: size in px; lineHeight unitless-em (1.1); letterSpacing |v|<0.25 reads as em, larger as px (force with letterSpacingUnit:'px'|'em'); wordSpacing always px. buttons:{radius, padding:{y,x}, bg, text, hover, typography:{size,weight,letterSpacing}}, forms:{labelColor,fieldText,fieldBg,border,focus,radius}, images:{radius,opacity}, layout:{containerWidth,contentWidth,widgetSpacing}}. Most fields are OPTIONAL — headings/body/links/buttons/forms are DERIVED from the core palette when omitted, so even a colors+scale kit themes the whole site. COLORS: primary/secondary/accent/text map to Elementor's 4 SYSTEM colors; bg/border AND ANY OTHER named color you add (e.g. primary_hover, primary_active, success, warning, error, info, surface_sunken) each become an Elementor CUSTOM global color shown in Site Settings → Global Colors. Pass the user's FULL palette — extra brand tokens ARE applied, not dropped. On an ESTABLISHED site that already has a customized kit, the API returns error='existing_kit_conflict' with the current colors/fonts — that's the double-ask: show the user, and only then re-call with override_existing_kit=true. New/empty sites apply on confirm alone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | 'full' (default: Global Colors/Fonts + derived Theme Style controls for h1–h6, body, links, buttons, forms) or 'tokens' (ONLY Global Colors/Fonts/type scale — the narrow blast radius for a palette fix on a live site) | |
| confirm | No | Must be true to apply — guards a site-wide change | |
| dry_run | No | Return the computed Elementor kit settings without writing | |
| site_id | Yes | WordPress site id | |
| brand_kit | Yes | Brand kit token object. colors: the 6 named slots PLUS any extra named colors (they become custom global colors). typography + buttons. | |
| override_existing_kit | No | Second confirmation to overwrite an EXISTING customized kit (established sites only). Only set after showing the user the current kit from the existing_kit_conflict response. |