bricks_create_acf_field_group
Overview
Creates an ACF (Advanced Custom Fields) field group with fields and location rules. Supports 20+ field types including text, image, repeater, relationship, taxonomy, and more.
Location rules control where the field group appears in the WordPress admin (e.g., on specific post types, page templates, or user roles). The tool generates a PHP file in the child theme for persistence across deployments.
This is the primary tool for defining custom data structures that power dynamic content in Bricks templates via {acf_field_name} dynamic data tags.
Key Features
When to Use
You are building a dynamic Bricks template that needs structured content (hero settings, team details, pricing data)
You want repeater fields for flexible content like feature lists or FAQ items
You need relationship fields to connect posts across post types
You are setting up a custom post type and need its data schema
A child theme must be active (use bricks_ensure_child_theme first)
The target post type should exist if using location rules based on post_type
When NOT to Use
The field group already exists and you want to update it — manage through ACF admin
You only need to set field values — use bricks_set_acf_values
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
titlestringREQUIREDWarning: 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
fieldsarray of objectsREQUIREDWarning: 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
location_rulesarray of objectsREQUIREDWarning: 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
positionstring (enum)optionalnormalCode 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
Create a Hero Settings field group
Creates fields for hero title, background image, and CTA button text on pages.
bricks_create_acf_field_group({
title: "Hero Settings",
fields: [
{ name: "hero_title", type: "text", label: "Hero Title", required: true },
{ name: "hero_background", type: "image", label: "Background Image", return_format: "array" },
{ name: "hero_cta_text", type: "text", label: "CTA Button Text", default_value: "Get Started" },
{ name: "hero_cta_link", type: "url", label: "CTA Link" }
],
location_rules: [
{ param: "post_type", operator: "==", value: "page" }
],
position: "acf_after_title"
})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
Create a repeater field group for features
Creates a repeater field with sub-fields for icon, title, and description on a custom post type.
bricks_create_acf_field_group({
title: "Service Features",
fields: [
{
name: "features",
type: "repeater",
label: "Features",
sub_fields: [
{ name: "icon", type: "text", label: "Icon Class" },
{ name: "title", type: "text", label: "Feature Title" },
{ name: "description", type: "textarea", label: "Description" }
]
}
],
location_rules: [
{ param: "post_type", operator: "==", value: "service" }
]
})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
Tip: After creating a field group, use bricks_create_post to populate content in the custom post type, including ACF field values via the meta parameter.
Tip: For repeater fields used with Bricks query loops, set the return_format of sub-fields appropriately. Image sub-fields should use « array » or « url » format for compatibility with Bricks dynamic data tags.
Warning: Known parameter mismatch: the TypeScript tool sends location_rules but the PHP endpoint expects location. The tool handles this transformation internally, but if you see fields appearing on the wrong post types, check the generated PHP file in {child-theme}/bricks-mcp/.
Warning: ACF Pro is required. The free version of ACF does not support repeater, group, or gallery field types.