bricks_update_custom_element
Overview
Updates an existing custom Bricks element. You can modify the label, controls, render template, CSS, and/or builder template. Only the provided fields are updated — omitted fields remain unchanged.
This tool regenerates the PHP file in the child theme with the updated code. Existing instances on pages will immediately reflect the changes since the rendering is done at runtime via PHP.
Key Features
When to Use
When adding new controls to an existing custom element
When updating CSS styling for a custom element
When adding or improving the Vue.js builder template for WYSIWYG editing
Know the element name/slug to update
When NOT to Use
When deleting a custom element — use bricks_delete_custom_element
When the change requires a new element name/slug (create new and delete old instead)
Parameters
Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
namestringREQUIREDWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
labelstringoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
controlsarrayoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
render_htmlstringoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
cssstringoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
builder_templatestringoptionalCode Examples
Update CSS styling for a custom element
Changes only the CSS without affecting the controls or render template.
bricks_update_custom_element({
name: "pricing-card",
css: ".pricing-card { padding: 48px 36px; border-radius: 16px; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,0.08); text-align: center; transition: transform 0.3s ease; }n.pricing-card:hover { transform: translateY(-4px); }n.pricing-card.highlighted { border: 2px solid var(--bricks-color-primary); transform: scale(1.05); }"
}){
"success": true,
"data": {
"name": "pricing-card",
"file": "/wp-content/themes/bricks-child/bricks-mcp/element-pricing-card.php"
}
}Common Mistakes
// Only sending the new control — all other controls are lost!
bricks_update_custom_element({ name: "pricing-card", controls: [
{ key: "subtitle", type: "text", label: "Subtitle" }
] })// First read existing controls, then add the new one
// bricks_read_custom_element({ name: "pricing-card" })
// Then include ALL controls:
bricks_update_custom_element({ name: "pricing-card", controls: [
{ key: "plan_name", type: "text", label: "Plan Name" },
{ key: "price", type: "text", label: "Price" },
{ key: "subtitle", type: "text", label: "Subtitle" }
// ... all other existing controls
] })Tips & Warnings
Control replacement: When providing controls, the entire array replaces existing controls. Always read the current controls first with bricks_read_custom_element before updating.
Remove builder template: Set builder_template to an empty string to remove the Vue.js template and fall back to default builder rendering.
PHP file regeneration: The tool regenerates the entire PHP file in the child theme. Previous file contents are overwritten.