bricks_audit_site

Phase 5IntermediateRead OnlyComplexity: 5/10
Run a site-wide quality check across all pages

Overview

Performs a site-wide audit across all Bricks pages and templates. Checks for unused classes, unused colors, duplicate styles, component candidates, consistency issues, and template problems.

Unlike bricks_analyze_page which focuses on a single page, this tool examines the entire site to find cross-page issues like orphaned design system tokens, inconsistent styling patterns, and opportunities to extract reusable components.

Run this periodically or after major site changes to keep the design system clean and identify optimization opportunities.

Key Features

6 Site-Wide Checks
Checks for unused_classes, unused_colors, duplicate_styles, component_candidates, consistency, and templates. Each identifies cross-page optimization opportunities.
Component Candidate Detection
Automatically identifies element structures that appear 3+ times across the site and should be extracted into reusable components for consistency and maintainability.
Design System Cleanup
Finds unused global classes and colors that can be safely deleted, keeping the design system lean. Also detects duplicate inline styles that should be consolidated.
Template Validation
Checks that header, footer, and section templates have proper display conditions and are not conflicting with each other.

When to Use

You want to find unused global classes or colors that can be cleaned up
You suspect duplicate inline styles across pages that should be extracted into global classes
You want to identify repeated element patterns that should become components
You need to verify consistency of styling across the entire site
You want to check that all templates have proper conditions assigned
Prerequisites
At least one Bricks page or template must exist
Bricks Builder version 1.9 or higher

When NOT to Use

You want to analyze a single page — use bricks_analyze_page instead
You want a pre-publish validation gate — use bricks_validate_page instead
You want to fix issues — run this first, then use bricks_fix_audit_issues on individual pages

Parameters

1 Total Parameters1 Optional

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
checksarray of strings (enum)optional
Specific checks to run. Options: unused_classes, unused_colors, duplicate_styles, component_candidates, consistency, templates. Omit to run all checks.
Default: all checks

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Full site audit

Runs all site-wide checks to get a comprehensive quality report.

JSON
bricks_audit_site()
// Returns:
// {
//   issues: [
//     { category: "unused_classes", message: "Class 'old-card' is not used on any page" },
//     { category: "component_candidates", message: "Feature card pattern found 6 times across 3 pages" },
//     { category: "duplicate_styles", message: "Identical typography found on 12 headings across 4 pages" }
//   ],
//   summary: { unused_classes: 3, unused_colors: 1, component_candidates: 2 }
// }

Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Check only for cleanup opportunities

Runs only the design system cleanup checks.

JSON
bricks_audit_site({
  checks: ["unused_classes", "unused_colors", "duplicate_styles"]
})

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
Some checks like component_candidates and consistency require multiple pages to produce meaningful results. On a single-page site, these checks may return no findings.

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
A class reported as "unused" may be referenced in custom CSS or JavaScript. Before deleting, use bricks_get_class_usage to verify it is truly unreferenced.

Tips & Warnings

Tips & Warnings

Tip: Run this after completing all pages to identify design system cleanup opportunities. Remove unused classes and colors to keep the design system lean.

Tip: Component candidates are high-value findings. Extracting repeated patterns into components reduces element count, ensures consistency, and makes future updates easier.

Warning: This tool scans all pages and templates, which may take longer on sites with many pages. Use selective checks for faster targeted audits.

Return Values

FieldTypeDescription
issuesarrayArray of issue objects with category, severity, page/element references, message, and priority ranking.
summaryobjectSummary of findings by category with counts and overall site health score.
recommendationsarrayPrioritized list of recommended actions to improve site quality.

Related Tools

Technical Details

Tool ID
bricks_audit_site
API Endpoint
/analysis/site
HTTP Method
POST
Namespace
analysis
Source File
analysis/page-audit.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with 6 site-wide checks: unused classes/colors, duplicate styles, component candidates, consistency, and template validation.
20250101