wp_update_page
Replace a PAGE/POST's content (refine/redesign in place). PREFER sections — the native Elementor CONTAINER (flexbox) spec so the page stays editable. Shape: [{direction:row|column, width:boxed|full, children:[{widthPercent, widgets:[{type,...}]}]}] (or widgets directly for one container). SECTION STYLING: a section/container accepts its OWN {bg:'#0E2F54' | {from,to,angle} gradient | {image:url} photo, overlay:{color,opacity} (over a bg image), shape:{type:'curve'|'waves'…,color,height} shape dividers, gap, min_height:'80vh', hidden:['mobile'], text_color, padding, radius, shadow, style:{…}} — bg colors the whole band and text_color propagates to child widgets. Full section vocabulary: wp_style_keys('container'); ready-made patterns: wp_section_recipes. Widget types: heading,text,button,image,icon-box,image-box,icon-list,counter,divider,spacer,testimonial,accordion,tabs,star-rating,gallery,image-carousel; Pro: form,price-table,call-to-action,testimonial-carousel (auto-downgraded to free composites if the site lacks Elementor Pro). Use elementor_search/elementor_get for exact widget fields. STYLING: every widget accepts a style object translated to NATIVE Elementor controls — {color, bg, align, fontSize, fontWeight, lineHeight, padding, margin, border:{width,color,radius,style}, shadow:{color,x,y,blur}, radius, tablet:{…}, mobile:{…}} — plus a raw settings passthrough. ANIMATION (just name a preset — no code): PREFER style.anim:'reveal' = scroll animation via the bundled GSAP runtime (presets: reveal, fade-up, stagger, parallax, zoom, pin, slide-left/right; optional {preset,delay,stagger}); put anim:{stagger:true} on a CONTAINER to cascade its children. It lazy-loads GSAP only where used, honors reduced-motion, and renders reliably (visible even if JS is slow). style.animate:'fade-up' = native Elementor entrance — needs no plugin but leaves the element elementor-invisible until Elementor's JS runs, so it can look blank in a render_screenshot; use it only for sites without the latest connector. BRAND TOKENS: if a Global Brand Kit is set, reference it instead of hardcoding — style.color:'@primary' (@secondary/@accent/@text/@bg/@border), style.bg:'@bg', and style.typographyToken:'h1' (h1–h6/body/small) or style.font:'@heading'/'@body'. These map to Elementor GLOBALS so one kit edit restyles the whole site — and it saves tokens vs re-sending hex/fonts. Call wp_get_brand_kit first for the available ids. NEVER generate custom CSS (custom_css is stripped) — native controls keep pages editable in Elementor's UI. html = single-piece escape hatch ONLY, never the whole page. EDITS A PAGE/POST ONLY — never a Theme Builder header/footer template or the site kit (those change every page). Round-trip validated, write-gated; review via render_screenshot before publishing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | No | Last resort: a self-contained HTML block for the whole page (not editable in Elementor) | |
| title | No | Optional new page title | |
| atomic | No | Editor V4 ATOMIC spec (JSON array) for sites where Editor V4 is active: [{type: heading|paragraph|image|button|div|flex|grid|tabs, …}]; tabs = {type:"tabs", tabs:[{label, children:[…]}], active:0}. XeoRank emits valid V4 JSON (e-tabs/e-tabs-menu/e-tab/e-tabs-content-area/e-tab-content, typed envelopes, ids). wp_widget_schema("e-tabs") and wp_section_recipes("v4-tabs") show the shape. Raw elements also accepted via elementor_data/elements. | |
| blocks | No | Gutenberg block markup (<!-- wp:… -->) — replaces post_content on a BLOCK or classic page. Read the current markup with wp_get_page(include_content=true), edit, send it back. Plugin transport. Refused with 409 on an Elementor-built page unless force_builder=true. | |
| dry_run | No | Build + round-trip validate + return a preview (warnings, size) WITHOUT writing (no quota used) | |
| post_id | Yes | The page/post ID to update (NOT a header/footer template or kit) | |
| site_id | Yes | The WordPress site ID | |
| sections | No | PREFERRED: native Elementor CONTAINER spec — [{direction,width,children:[{widthPercent,widgets:[{type,...}]}]}] | |
| force_builder | No | With `blocks`: allow converting an Elementor-built page to block content (deletes its Elementor data). Default false. | |
| elementor_data | No | Raw _elementor_data JSON (advanced) |