bricks_get_page_content
Overview
Retrieve the Bricks element tree for a page. Returns all elements with their settings, parent-child hierarchy, and global class assignments. This is the primary tool for inspecting what is already on a page before making modifications.
Supports two modes: « summary » for a lightweight overview showing element types and text content, and « full » for complete settings including all styles and responsive breakpoints. Can read from the main content area, header overrides, or footer overrides.
Key Features
When to Use
You want to find specific element IDs for use with bricks_update_element or bricks_delete_element
You need to understand the element hierarchy before inserting new elements
You want to check which global classes are assigned to existing elements
You need to verify that a section was added correctly after calling bricks_add_section
When NOT to Use
You want to find an element by its ref/label name (use bricks_get_element_by_ref instead)
You need to search for specific text content across all pages (use bricks_search_content instead)
Parameters
page_idnumberREQUIREDmodestringoptionalsummary Values: summary, fullcontent_areastringoptionalcontent Values: content, header, footerCode Examples
Get page structure summary
Quickly see what sections and elements exist on a page without fetching full style data.
bricks_get_page_content({
page_id: 33,
mode: "summary"
}){
"elements": [
{ "id": "abc123", "type": "section", "parent": 0, "children": ["def456"] },
{ "id": "def456", "type": "container", "parent": "abc123", "children": ["ghi789"] },
{ "id": "ghi789", "type": "heading", "parent": "def456", "text": "Welcome Home", "tag": "h1" }
],
"element_count": 3
}Get full element data for debugging
Retrieve complete settings including CSS properties and responsive breakpoints.
bricks_get_page_content({
page_id: 33,
mode: "full",
content_area: "content"
}){
"elements": [
{
"id": "ghi789",
"type": "heading",
"parent": "def456",
"settings": {
"tag": "h1",
"text": "Welcome Home",
"_typography": { "font-size": "56px", "font-weight": "700" },
"_typography:mobile_portrait": { "font-size": "32px" }
},
"_cssGlobalClasses": ["abc123"]
}
]
}Common Mistakes
bricks_get_page_content({
page_id: 33,
mode: "full"
})
// Large payload when you just need IDsbricks_get_page_content({
page_id: 33,
mode: "summary"
})
// Lightweight, returns types and textTips & Warnings
Use summary mode first: Summary mode is much faster and lighter. Only switch to full mode when you need to inspect specific CSS settings or debug styling issues.
Element IDs are 6-char hex strings: These IDs are needed for bricks_update_element, bricks_delete_element, bricks_insert_element, and other element manipulation tools.
Prefer bricks_get_page_summary: For just understanding the section structure of a page, bricks_get_page_summary is even lighter and organized by sections.