bricks_fix_audit_issues
Overview
Automatically fixes issues identified by bricks_analyze_page. Supports 8 fix types: add alt text, fix heading order, extract inline styles to classes, add responsive breakpoints, fix color contrast, remove empty elements, optimize nesting, and add ARIA attributes.
Each fix returns before/after state so you can verify the changes. This is the action companion to the diagnostic bricks_analyze_page tool.
Use this as the final step in the Phase 5 polish workflow to automatically remediate common quality issues without manual element-by-element editing.
Key Features
When to Use
You need to quickly add alt text to images that are missing it
You want to fix heading hierarchy gaps (e.g., h1 followed by h3 without h2)
You want to extract repeated inline styles into a global class
You need to add responsive breakpoints to elements that lack them
The target page must exist and contain Bricks elements
Bricks Builder version 1.9 or higher
When NOT to Use
You want site-wide fixes — this tool works on one page at a time
You need manual control over the fix — use bricks_update_element 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
page_idnumberREQUIREDWarning: 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
fixesarray of objectsREQUIREDCode 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
Fix heading order and add alt text
Applies two common fixes: corrects heading hierarchy and adds alt text to images.
bricks_fix_audit_issues({
page_id: 33,
fixes: [
{ type: "fix_heading_order" },
{ type: "add_alt_text" }
]
})
// Returns:
// {
// applied: [
// { type: "fix_heading_order", element_id: "abc123",
// before: { tag: "h3" }, after: { tag: "h2" }, success: true },
// { type: "add_alt_text", element_id: "def456",
// before: { alt: "" }, after: { alt: "Team meeting photo" }, success: true }
// ],
// summary: { attempted: 2, successful: 2, failed: 0 }
// }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
Extract inline styles to a global class
Extracts repeated inline typography styles into a new global class.
bricks_fix_audit_issues({
page_id: 33,
fixes: [
{
type: "extract_class",
params: {
element_id: "abc123",
class_name: "heading-feature"
}
}
]
})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 1935
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
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 1935
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
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 1935
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
Tips & Warnings
Tip: The recommended workflow is: (1) bricks_analyze_page to find issues, (2) review findings, (3) bricks_fix_audit_issues for auto-fixable items, (4) bricks_update_element for manual fixes, (5) re-run analysis to verify.
Tip: The add_alt_text fix generates descriptive alt text based on the image context (surrounding headings, nearby text). Review generated alt text for accuracy.
Warning: The remove_empty fix permanently deletes elements with no content or children. This cannot be undone unless you restore from page history.
Warning: The optimize_nesting fix removes unnecessary wrapper divs. If those wrappers have CSS classes or custom styles applied, the styling may be lost.