bricks_register_taxonomy
Overview
Registers a custom WordPress taxonomy and associates it with one or more post types. The taxonomy can be hierarchical (category-like with parent/child relationships) or flat (tag-like). A PHP file is generated in the child theme’s bricks-mcp/ directory and auto-loaded on every page load.
After registration, create terms with bricks_create_term and assign them to posts with bricks_assign_terms. Use {post_terms_TAXONOMY} dynamic tag to display terms on the frontend.
Key Features
When to Use
When posts need to be grouped, filtered, or sorted by custom criteria
Before creating query filters that filter by taxonomy terms
When building a filterable portfolio, directory, or catalog
When NOT to Use
When you need a simple custom field — use ACF fields instead of a taxonomy
When the taxonomy is only for internal organization — consider post meta instead
Parameters
slugstringREQUIREDlabelstringREQUIREDsingular_labelstringREQUIREDobject_typesarrayREQUIREDhierarchicalbooleanoptionalfalseCode 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
Register a Hierarchical Taxonomy
Creates a hierarchical taxonomy for the portfolio post type. Terms can have parent/child relationships like categories.
bricks_register_taxonomy({
slug: "project_type",
label: "Project Types",
singular_label: "Project Type",
object_types: ["portfolio"],
hierarchical: true
})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
Register a Flat Taxonomy for Multiple Types
Creates a flat tag-like taxonomy shared between portfolio items and team members.
bricks_register_taxonomy({
slug: "skill",
label: "Skills",
singular_label: "Skill",
object_types: ["portfolio", "team_member"],
hierarchical: false
})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
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
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
Tips & Warnings
Known parameter mismatch: The TypeScript tool sends object_types but the PHP endpoint expects post_types. If the taxonomy ends up attached to the wrong post type, check the generated PHP file at {child-theme}/bricks-mcp/ and correct the post_types array manually.
Dynamic data: Use {post_terms_SLUG} to display terms in templates. For filter interfaces, enable query filters in site settings first, then use bricks_add_query_filter.