bricks_delete_custom_element

UtilityIntermediateDestructiveComplexity: 3/10
Delete a custom element

Overview

Deletes a custom Bricks element by removing its PHP file from the child theme. After deletion, the element type will no longer be available in the Bricks element panel, and any existing instances on pages will stop rendering.

This is a destructive operation. Unlike components which have a usage check, custom element deletion does not verify whether instances exist on pages. Ensure no pages are using the element before deleting it.

Key Features

File Removal
Deletes the PHP file from the child theme's bricks-mcp/ directory, completely unregistering the element.
Immediate Effect
The element is immediately removed from the Bricks panel and stops rendering on all pages.

When to Use

When removing a custom element that is no longer needed
When cleaning up test or draft elements during development
When replacing an element with a newer version (create new first, then delete old)
Prerequisites
Element name/slug must be known (from bricks_list_custom_elements)
Verify no pages are using the element (use bricks_search_content to check)
A Bricks child theme must be active

When NOT to Use

When the custom element is used on any pages — remove instances first
When you want to update the element — use bricks_update_custom_element instead
When you want to temporarily disable it — there is no disable option, consider renaming instead

Parameters

1 Total Parameters1 Required

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
namestringREQUIRED
Element name/slug to delete (e.g., "pricing-card")

Code Examples

Delete a custom element

Removes the pricing-card custom element from the child theme.

JSON
bricks_delete_custom_element({
  name: "pricing-card"
})
Response
{
  "success": true,
  "message": "Custom element 'pricing-card' deleted successfully"
}

Common Mistakes

Deleting a custom element without checking if it is used on pages
Search for the element name across all pages first. Use bricks_search_content or manually check pages that might use the element.
Wrong
// Deleting without checking usage
bricks_delete_custom_element({ name: "pricing-card" })
Correct
// Step 1: Search for usage
bricks_search_content({ query: "pricing-card" })
// Step 2: Remove instances from pages
// Step 3: Then delete safely
bricks_delete_custom_element({ name: "pricing-card" })

Tips & Warnings

Tips & Warnings

Destructive and immediate: The PHP file is deleted from disk immediately. There is no undo or trash mechanism. Back up the file contents using bricks_read_custom_element before deleting.

No usage check: Unlike bricks_delete_component, this tool does not check for existing instances. Manually verify no pages use the element before deleting.

Broken instances: Pages with instances of the deleted element will show empty or broken elements. Clean up instances before deleting the element definition.

Return Values

FieldTypeDescription
successbooleanWhether the custom element was deleted successfully
messagestringConfirmation message

Related Tools

Technical Details

Tool ID
bricks_delete_custom_element
API Endpoint
/bricks-mcp/v1/custom-elements/{name}
HTTP Method
DELETE
Namespace
components
Source File
components/custom-elements.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release
20250101