Update Page Builder layout is a WordPress ability from Page Builder by SiteOrigin — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.
Install Free Plugin →Update Page Builder layout
WriteWrite a post's Page Builder layout — either the classic meta-stored layout or a specific block-stored Layout Block — through the plugin's own sanitizer.
Requires the Page Builder by SiteOrigin plugin on WordPress 6.9+ for the Abilities API (both abilities are registered only when wp_register_ability() exists, guarded so the plugin never fatals on older WordPress). Both abilities additionally require the caller to hold the 'edit_post' capability for the specific post being read or written.
What it does
This ability persists a panels_data payload (widgets, grids, grid_cells) to a post's Page Builder layout, routing the write through the exact same sanitization the corresponding human-driven save uses: process_raw_widgets() re-sanitizes every widget, the sidebars-emulator and public siteorigin_panels_data_pre_save filter run when applicable, and a kses floor is forced over the widget output regardless of the caller's unfiltered_html capability, because the input is AI-originated and treated as untrusted. When block_index is omitted and the post has an existing classic layout, the write targets that meta-stored layout; when the post stores its layout in one or more Layout Blocks, block_index selects which block to write (it defaults to 0 for a single-block post, but is required when a post has multiple Layout Blocks — an out-of-range or missing index on a multi-block post is declined as 'block-ambiguous' rather than guessed, so a wrong block is never silently overwritten). Passing panels_data with no widgets and no grids clears the classic layout (deletes the meta) rather than persisting an empty layout. Call layout-get first to discover the post's storage mode and, for block-stored posts, its valid block_index range.
See it in action
You ask your AI assistant
"Update the Page Builder layout on post 42 with this new panels_data, and if it has multiple Layout Blocks, target block index 1."
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| post_id | integer | Yes | Post ID of the layout to update. |
| panels_data | object | Yes | Canonical panels_data to persist (widgets, grids, grid_cells). |
| block_index | integer | No | For block-stored posts, the 0-based index (from layout-get) of the Layout Block to write. Optional for a single-block post (defaults to 0); required when the post has multiple Layout Blocks. Ignored for classic/meta posts. |
Returns
An object with post_id, updated (boolean), source (one of 'meta', 'block', 'block-ambiguous', or 'unsupported' describing which storage path was written or why it was declined), block_index (present on a successful block write), and a message describing the outcome (e.g. layout cleared, save failed, or which block_index range is valid).
Permission
The current user must have the 'edit_post' capability for the target post.