Conditional logic
Showing fields conditionally#
Every field has a Conditional Logic toggle in its settings. Switch it on and the field is hidden until its conditions are met. A condition compares another field in the same group against a value:
Show this field if
layout_styleis equal tocustom
The operators read as words in the builder (is equal to, is not equal to, contains, is greater than, is less than) and are stored as ==, !=, contains, > and <. The target can be any other field in the group: a common pattern is a select or true/false field that reveals extra options.
When the field you compare against has fixed choices, the value is a dropdown of those choices rather than a text box, so there is no key to mistype. That covers select, radio, checkbox and button group. A stored value that is no longer one of the choices keeps its own entry in the list, marked (not in the list), instead of quietly becoming the first choice the moment you open the field.
The form builder's conditions work the same way, with the same operators and the same choice dropdown.
Combining conditions#
Conditions follow the same AND/OR structure as location rules:
- And adds a condition to the current group: all conditions in the group must hold.
- Or starts a new condition group: the field shows when any group holds.
So "show when type == video and source == external, or when override == 1" is three conditions in two groups.
Notes#
- Conditional logic works in the admin metabox and in front-end forms: the same rules are rendered as data attributes and evaluated in the browser as values change.
- Conditions react to the field's current value in the editor, not the saved value, so toggling a checkbox reveals its dependent fields immediately.