bricks_set_dynamic_data

Phase 4IntermediateComplexity: 5/10
Connect element settings to dynamic data tags

Overview

Connect a Bricks element setting to WordPress dynamic data using Bricks dynamic data tags. This tool sets a tag like bricks_set_dynamic_data or {acf_field_name} on any element property, making the element display live data from the database instead of static text.

The setting_key supports dotted paths for nested settings (e.g., « image.url », « _background.image.url »), and tags support arguments for fallbacks, filtering, and formatting. This is essential for any dynamic content — query loop items, single post templates, and ACF-powered layouts.

Key Features

Dotted Path Setting Keys
Supports nested setting paths like "text", "image.url", and "_background.image.url" to target any element property at any depth.
Tag Arguments
Append @key:'value' arguments for fallbacks, formatting, and data extraction. E.g., bricks_set_dynamic_data or {acf_data @key:'nested|path'}.
Colon Filters
Apply transformation filters like :uc (uppercase), :truncate:100 (truncate to 100 chars), and other text processing filters.
90+ Dynamic Tags
Access post data, author info, user fields, site settings, ACF/Meta Box fields, WooCommerce data, and custom tags.

When to Use

Connecting heading text to bricks_set_dynamic_data inside a query loop or single post template
Setting an image element source to {featured_image_url} for dynamic thumbnails
Binding ACF field values to elements with {acf_field_name} tags
Setting background images dynamically with {acf_hero_background} on a section
Adding fallback values for empty fields with the @fallback argument
Prerequisites
An existing element on a page (created via bricks_add_section or bricks_insert_element)
The element must exist in the specified page and content area
For ACF tags: ACF plugin must be active with the field group configured
For query loop data: a query loop must be configured on a parent element

When NOT to Use

Setting static/hardcoded text that does not come from the database — just set the text in element settings directly
You need to list available dynamic tags first — use bricks_list_dynamic_tags to discover tags

Parameters

7 Total Parameters4 Required3 Optional
page_idnumberREQUIRED
Page (post) ID containing the target element.
element_idstringREQUIRED
Target element ID (6-char hex) to set the dynamic data on.
setting_keystringREQUIRED
Dotted path to the setting key. Examples: "text", "image.url", "_background.image.url", "link.url".
tagstringREQUIRED
Dynamic data tag string. Examples: "bricks_set_dynamic_data", "{featured_image_url}", "{acf_hero_text}", "{woo_product_price}".
argumentsobjectoptional
Tag arguments as key-value pairs appended as @key:'value'. Keys include: fallback, fallback-image, sanitize, exclude, start-at, pad, key, query.
filtersstring[]optional
Colon filters to apply to the tag value (e.g., [":uc", ":truncate:100"]).
content_areastringoptional
Content area where the element resides.
Default: content Values: content, header, footer

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

Connect elements to post data in a query loop

Set dynamic data on heading, text, and image elements inside a query loop to display post title, excerpt, and featured image.

JSON
// Heading shows post title
bricks_set_dynamic_data({
  page_id: 123,
  element_id: "abc123",
  setting_key: "text",
  tag: "bricks_set_dynamic_data"
});

// Text shows post excerpt with fallback
bricks_set_dynamic_data({
  page_id: 123,
  element_id: "def456",
  setting_key: "text",
  tag: "Connect element settings to dynamic data tags",
  arguments: { "fallback": "No excerpt available" }
});

// Image shows featured image
bricks_set_dynamic_data({
  page_id: 123,
  element_id: "ghi789",
  setting_key: "image.url",
  tag: "{featured_image_url}"
});

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

ACF field with background image

Set a section background image from an ACF image field, and bind an ACF text field to a heading.

JSON
// Section background from ACF image field
bricks_set_dynamic_data({
  page_id: 45,
  element_id: "sec001",
  setting_key: "_background.image.url",
  tag: "{acf_hero_background}"
});

// Heading text from ACF field with fallback
bricks_set_dynamic_data({
  page_id: 45,
  element_id: "hdg001",
  setting_key: "text",
  tag: "{acf_hero_title}",
  arguments: { "fallback": "Welcome to Our Site" }
});

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
Dynamic data tags must be wrapped in curly braces: bricks_set_dynamic_data, not post_title. Without braces, the text is treated as a literal string.

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
Image elements use "image.url" for the source, not just "image" or "url". Background images use "_background.image.url". Always use the correct dotted path.