bricks_get_component_usage
Overview
Retrieves usage statistics for a Bricks Component, showing which pages, templates, and posts use it along with instance counts. This tool is essential for understanding the impact of modifying or deleting a component.
Use this tool before making breaking changes to a component (updating properties, renaming, or deleting) to understand how many instances exist across the site and where they are located.
Key Features
When to Use
Before making breaking changes to a component to understand the impact
When auditing component usage across the site
When deciding whether to update a component or create a new version
When NOT to Use
When you want to modify the component itself — use bricks_update_component
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
component_idstringREQUIREDCode Examples
Check component usage before deletion
Verifies whether a component is in use and how many instances exist.
bricks_get_component_usage({
component_id: "abc123"
}){
"total_instances": 12,
"pages": [
{ "id": 33, "title": "Homepage", "instance_count": 6 },
{ "id": 45, "title": "Services", "instance_count": 4 },
{ "id": 67, "title": "About Us", "instance_count": 2 }
],
"templates": []
}Common Mistakes
bricks_delete_component({ component_id: "abc123", force: true })bricks_get_component_usage({ component_id: "abc123" })
// Check total_instances > 0 before proceeding
bricks_delete_component({ component_id: "abc123" })Tips & Warnings
Always check before deleting: This tool is the safety net for component management. Make it a habit to run it before any destructive operation.
High instance counts: If a component has many instances, updating it (rather than deleting) is the safest approach. Updates propagate to all instances automatically.