Insert Bricks Element


Adds a new element to a Bricks page by copying an existing element of the same page (with everything inside it, unless include_children is false), giving the copies new IDs, and placing the copy next to the original or at a position inside a layout element (section, container, block or div). The copy can get new text and a label straight away. Elements are copied rather than built from scratch so that every new element has a structure Bricks itself created. Saved to the live page at once, with backup, lossless check, conflict check and read-back. To remove an inserted element, call mosmcp/bricks-restore-backup with the backup_id this returns. The Bricks Builder access role setting is not checked; WordPress edit_post is (plus the Bricks builder-access check, when Bricks provides one at runtime).

Also known as: duplicate Bricks element, add section, add heading, add button, clone block.

Property Value
Ability slug mosmcp/bricks-insert-element
Wire tool name mosmcp__bricks-insert-element
Category Bricks Builder (mosmcp-bricks)
Plan Pro

 

Required access

Requirement Value
Capability edit_post (checked against the specific post)
Minimum default role Contributor
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
post_id integer (min 1) Yes — ID of the page, post or Bricks template.
area string (one of content, header, footer) — Which Bricks area of the post: content (default), or the header or footer stored on it. Header and footer templates default to their own area.
source_element_id string (min length 1) Yes — ID of the existing element to copy (see mosmcp/bricks-read-page-structure).
include_children boolean true Also copy everything inside the element.
parent_id string — Optional. ID of the section, container, block or div to put the copy in, or "0" for the top level (only for a top-level element). Omit to place it in the original's parent.
position integer (min 0) — Optional. Zero-based position among the destination's children. Omit to place the copy right after the original (same parent) or last (other parent).
text string — Optional new text for the copy, when it is a heading, text-basic, text or button element.
label string — Optional builder label for the copy.
expected_hash string Yes — Required. The layout_hash from your last read of this area. The change is refused if the layout changed since, so an edit made meanwhile in the Bricks builder is never overwritten.

 

Output schema

Field Type Required Description
post_id integer Yes
title string
post_type string
view_url string
builder_url string Opens the post in the Bricks builder.
area string Yes
element_id string Yes The changed element, or the new copy.
element object The element as now stored, in the shape mosmcp/bricks-get-element returns.
changes object[] Yes What changed, as read back after saving.
changes[].field string
changes[].previous string | number | integer | boolean | array | object | null
changes[].current string | number | integer | boolean | array | object | null
layout_hash string Yes The new layout_hash, for a following edit.
previous_layout_hash string
backup object Yes
backup.meta_key string
backup.meta_id integer
notes string[]
warnings object[] Non-fatal issues encountered while running.
warnings[].code string
warnings[].message string
warnings[].context string
new_element_ids string[] IDs of every new element, the copy itself first.

 


<< Previous Next >>
Get Bricks Element List Bricks Global Classes

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.