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_style==custom
Available operators are ==, !=, 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.
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.