bricks_move_element
Overview
Move an existing element (and all its children) to a new position within the same page. The element can be moved to a different parent container or reordered within the same parent. The element retains all its settings, classes, and children — only the parent relationship and position change.
This is useful for reorganizing page layout without having to delete and recreate elements. For example, moving a CTA section from the bottom of a page to a different position, or reorganizing cards within a grid.
Key Features
When to Use
You want to move an element to a different parent container on the same page
You need to reorganize page structure by relocating elements between sections
You want to move an element to the page root level (parent "0")
When NOT to Use
You need to reorder root-level sections (use bricks_reorder_sections instead -- more efficient)
You want to duplicate an element and keep the original (use bricks_duplicate_element instead)
You need to move an element to a different content area (delete and recreate instead)
Parameters
page_idnumberREQUIREDelement_idstringREQUIREDnew_parent_idstringREQUIREDposition_indexnumberoptionalcontent_areastringoptionalcontent Values: content, header, footerCode Examples
Move a card to the first position in a grid
Reorder a card within the same parent container by moving it to position 0.
bricks_move_element({
page_id: 42,
element_id: "card03",
new_parent_id: "grid123",
position_index: 0
}){
"success": true,
"element_id": "card03",
"new_parent": "grid123",
"position": 0
}Move an element to a different container
Move a button from one container to another container in a different section.
bricks_move_element({
page_id: 42,
element_id: "cta-btn",
new_parent_id: "hero-container",
position_index: 2
}){
"success": true,
"element_id": "cta-btn",
"new_parent": "hero-container",
"position": 2
}Common Mistakes
bricks_move_element({
element_id: "card01",
new_parent_id: "heading-id" // cannot have children!
})bricks_move_element({
element_id: "card01",
new_parent_id: "container-id" // can hold children
})bricks_move_element({
element_id: "section-id",
new_parent_id: "container-id"
})
// Section inside a container = broken layoutbricks_reorder_sections({
page_id: 42,
section_order: ["section-2", "section-1", "section-3"]
})
// Use reorder for root sectionsTips & Warnings
For section reordering: Use bricks_reorder_sections instead of moving sections individually. It is more efficient and validates that all sections are accounted for.
Element ID is unchanged: The element keeps its original ID after moving. Any references to this element ID remain valid.
Verify hierarchy first: Use bricks_get_page_content in summary mode to understand the current parent-child relationships before moving elements.