bricks_bulk_update_elements

Phase 4AdvancedBatchComplexity: 7/10
Update multiple elements in one API call (deep merge)

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

Batch efficiency
Updates up to 100 elements in a single API call with one database write, drastically reducing overhead compared to individual update calls.
Deep merge settings
Settings are deep-merged into existing element settings, so you only need to specify what changes — existing settings are preserved.
Global class resolution
Accepts global class names (not IDs) and automatically resolves them to Bricks class IDs.
Content area targeting
Can target elements in different content areas (content, header, footer).

When to Use

When you need to update settings or classes on multiple elements at once
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
Prerequisites
Page must exist with Bricks content
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 updating a single element — use bricks_update_element for simplicity
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

3 Total Parameters2 Required1 Optional
page_idnumberREQUIRED
Page ID containing the elements to update.
updatesarrayREQUIRED
Array of element updates (max 100). Each item has element_id (string), optional settings (object to deep-merge), and optional globalClasses (array of class names that replaces existing classes).
content_areastringoptional
Content area containing the elements.
Default: content Values: content, header, footer

Code 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

JSON
{
  "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"] }
    ]
  }
}
Response
{
  "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
The updates array is limited to 100 elements per call. For larger batches, split into multiple calls.

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
The globalClasses parameter expects class NAMES (e.g., "heading-section"), not Bricks internal IDs. The tool resolves names to IDs automatically.

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
If an element_id does not exist on the page, that update will silently fail. Use bricks_get_page_content or bricks_get_element_by_ref to verify IDs first.

Tips & Warnings

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.

Return Values

FieldTypeDescription
updatednumberNumber of elements successfully updated.
failednumberNumber of elements that failed to update.
detailsarrayPer-element update results with element_id and status.

Related Tools

Technical Details

Tool ID
bricks_bulk_update_elements
API Endpoint
/bricks-mcp/v1/pages/{page_id}/elements/bulk
HTTP Method
PATCH
Namespace
pages-elements
Source File
pages/utilities.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release
20250101