Element Conditions Schema
Element display conditions control whether an element renders on the frontend. They are stored in the _conditions key inside any element’s settings object.
Data structure
Section titled “Data structure”Conditions use an OR-of-AND structure: the outer array contains OR groups, and each inner array contains AND items. The element renders if any OR group evaluates to true, and an OR group is true when all its AND items are true.
conditionItem properties
Section titled “conditionItem properties”Each condition item has the following properties:
| Property | Type | Required | Description |
|---|---|---|---|
id | string | integer | Yes | Unique identifier for this condition |
key | string | Yes | Condition type (see enum below) |
compare | string | Yes | Comparison operator (see table below) |
value | any | Conditional | The value to compare against. Not needed when compare is empty or empty_not. |
dynamic_data | string | No | Dynamic data tag to use as the value source |
Example
Section titled “Example”{ "_conditions": [ [ { "id": "abc123", "key": "user_logged_in", "compare": "==", "value": true }, { "id": "def456", "key": "user_role", "compare": "==", "value": "administrator" } ], [ { "id": "ghi789", "key": "dynamic_data", "compare": "contains", "value": "sale", "dynamic_data": "{post_title}" } ] ]}This reads as: show the element if (user is logged in AND is an administrator) OR (the post title contains “sale”).
Condition keys
Section titled “Condition keys”General
browsercurrent_urldatedatetimedynamic_datafeatured_imageoperating_systemreferertimeweekday
Post
post_authorpost_datepost_idpost_parentpost_statuspost_title
User
user_iduser_logged_inuser_registereduser_role
WooCommerce
woo_product_categorywoo_product_featuredwoo_product_newwoo_product_purchased_by_userwoo_product_ratingwoo_product_salewoo_product_sold_individuallywoo_product_stock_managementwoo_product_stock_quantitywoo_product_stock_statuswoo_product_tagwoo_product_type
Available compare operators vary by condition key. For example, post_id supports math operators (==, !=, >=, <=, >, <), while user_logged_in only supports == and !=.
Comparison operators
Section titled “Comparison operators”| Operator | Description |
|---|---|
== | Equal (loose comparison, supports arrays via intersection) |
!= | Not equal (loose comparison) |
>= | Greater than or equal |
<= | Less than or equal |
> | Greater than |
< | Less than |
contains | String contains substring |
contains_not | String does not contain substring |
empty | Value is empty (no value field needed) |
empty_not | Value is not empty (no value field needed) |
Extensibility
Section titled “Extensibility”Condition keys and comparison operators are filterable via PHP hooks:
bricks/conditions/groups: add custom condition groupsbricks/conditions/options: add custom condition keys with their own compare operatorsbricks/conditions/result: modify the boolean result of any individual condition evaluation
Third-party plugins can introduce additional condition keys beyond those listed above.
Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Thanks for sharing feedback. We're using it to improve these docs.