bricks_register_post_type
Overview
Registers a custom WordPress post type (CPT) by generating a PHP file in the child theme. The CPT becomes available in the WordPress admin, REST API, and Bricks Builder immediately after registration. The generated file is placed in the child theme’s bricks-mcp/ directory and auto-loaded on every page load.
The supports array controls which editor features (title, editor, thumbnail, excerpt, etc.) are available for the post type. After registration, use bricks_create_post to populate it with content and bricks_create_template to create archive/single templates.
Key Features
When to Use
Before creating templates that display custom content types
When you need a content type with a dedicated archive page
Before using bricks_create_post to populate content for the new type
When NOT to Use
When a plugin already provides the needed post type (e.g., WooCommerce products)
For temporary data — use custom database tables instead
Parameters
slugstringREQUIREDlabelstringREQUIREDsingular_labelstringREQUIREDdescriptionstringoptionaliconstringoptionaldashicons-admin-postsupportsarrayREQUIREDtitle, editor, thumbnail, excerpt, custom-fields, page-attributes, revisions, comments, trackbacks, authorhas_archivebooleanoptionalfalsepublicly_queryablebooleanoptionaltruehierarchicalbooleanoptionalfalseCode 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 Portfolio CPT
Creates a Portfolio custom post type with archive support, thumbnails, and excerpts. Available at /portfolio/ archive URL.
bricks_register_post_type({
slug: "portfolio",
label: "Portfolios",
singular_label: "Portfolio",
description: "Client project showcase",
icon: "dashicons-portfolio",
supports: ["title", "editor", "thumbnail", "excerpt"],
has_archive: true
})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 singular_label and icon, but the PHP endpoint expects singular and menu_icon. The client handles this mapping internally. If you need to manually edit the generated PHP file, look in {child-theme}/bricks-mcp/.
After registration: Follow up with bricks_register_taxonomy to add categories/tags, bricks_create_post to populate content, and bricks_create_template for archive and single templates.