bricks_bulk_update_elements
Overview
Updates multiple elements on a Bricks page in a single API call. Each update performs a deep merge on settings and resolves global class names to IDs automatically. This is significantly more efficient than calling bricks_update_element multiple times, as it performs a single database write and cache invalidation instead of one per element.
Key Features
When to Use
When assigning global classes to several elements after a design system update
When applying consistent styling changes across a section (e.g., updating typography on all headings)
When fixing audit issues that affect multiple elements on the same page
You must know the element IDs to update (use bricks_get_page_content or bricks_get_element_by_ref to find them)
Global class names must exist if using the globalClasses parameter
When NOT to Use
When replacing an entire section — use bricks_replace_section instead
When the updates span multiple pages — run one bulk_update_elements call per page
Parameters
page_idnumberREQUIREDupdatesarrayREQUIREDcontent_areastringoptionalcontent Values: content, header, footerCode Examples
Warning: Undefined array key "example_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 10
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Assign global classes to multiple headings
{
"tool": "bricks_bulk_update_elements",
"params": {
"page_id": 33,
"updates": [
{ "element_id": "abc123", "globalClasses": ["heading-section"] },
{ "element_id": "def456", "globalClasses": ["heading-card"] },
{ "element_id": "ghi789", "globalClasses": ["heading-card"] },
{ "element_id": "jkl012", "settings": { "_typography": { "text-align": "center" } }, "globalClasses": ["text-body"] }
]
}
}{
"updated": 4,
"failed": 0,
"details": [
{ "element_id": "abc123", "status": "updated" },
{ "element_id": "def456", "status": "updated" },
{ "element_id": "ghi789", "status": "updated" },
{ "element_id": "jkl012", "status": "updated" }
]
}Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Performance tip: Always prefer bricks_bulk_update_elements over multiple bricks_update_element calls when updating 2+ elements on the same page. It performs a single database write instead of N separate writes.
Deep merge behavior: Settings are deep-merged, meaning nested objects are merged recursively. To completely replace a nested object, include all its properties in the update. To remove a property, this tool cannot do that — use bricks_update_element with explicit null values instead.