Appearance
Relation Field Conditions
Voxel's conditional logic can show or hide form fields based on text, numbers, dates, files, taxonomies, and switchers — but not post relation fields. This function fills that gap: show or hide any field based on whether a relation field has posts selected.
Overview
Once enabled, post relation fields become available as condition sources in Voxel's post type editor, with two new rules:
- Is empty — the relation has no posts selected
- Is not empty — the relation has at least one post selected
Conditions are evaluated live on the submission form (as the user picks or removes related posts) and re-checked server-side on submit.
Key Features
- Works with every relation configuration: has one, has many, belongs to one, belongs to many
- Works with custom relation keys and relation fields inside repeaters
- Live evaluation in the Create Post form — fields appear/disappear as selections change
- No configuration needed — enable and the rules appear in the post type editor
Setup Instructions
- Navigate to Voxel Toolkit → Functions and enable Relation Field Conditions
- Go to Voxel → Post Types and open the post type's Fields tab
- Open any field's options and go to Conditional logic
- Choose your post relation field as the condition source
- Select Is empty or Is not empty
- Save the post type
Use Cases
Conditional Detail Fields
Show a "Venue details" group only when no venue is related — hide it when the event links to an existing venue post.
Guided Submissions
Require either a relation selection or manual entry: reveal manual address fields only when the relation is empty.
Progressive Forms
Reveal follow-up fields once the user connects their listing to a parent post.
Troubleshooting
The relation field doesn't appear as a condition source
- Verify the function is enabled under Voxel Toolkit → Functions
- Reload the post type editor after enabling
Conditions don't react on the frontend
- Hard-refresh the submission page (the evaluator script may be cached)
- Check the browser console for JavaScript errors from other plugins

