Support Forum
Support › Meta Box Conditional Logic › Conditional Logic, Advanced Taxonomy Fields with Radio buttonsResolved
I have a custom post type with two advanced taxonomy fields, both using radio formats. The first field is connected to the Name Type (name-type) Taxonomy which has only two terms: alternate (tag_id=310) and preferred (tag_id=311).
Using Conditional Logic in Field Settings (Meta Box Builder), I am trying to set the visibility of the second advanced taxonomy field as follows.
Visible when any conditions match
name-type contains 311
However, it doesn't work. When I select the “preferred” term in the first field, the second field doesn't appear. The code generated seems to come close to the suggested code in your documentation on “Meta Box Conditional Logic” in the Advanced Operators section (see code block below).
What I have tried:
Please advise.
[
'name' => __( 'Name Type', 'your-text-domain' ),
'id' => $prefix . 'name-type',
'type' => 'taxonomy_advanced',
'taxonomy' => ['name-type'],
'field_type' => 'radio_list',
'required' => true,
'admin_columns' => [
'position' => 'after title',
'sort' => true,
'searchable' => true,
'filterable' => true,
],
'columns' => 4,
'tooltip' => [
'icon' => '',
'position' => 'top',
'content' => 'Select whether this entry is for the preferred name which will display at the top of the individual\'s main page OR whether it is an alternate name which will link back to the main page.',
],
'before' => __( '</br>', 'your-text-domain' ),
'tab' => 'description',
],
[
'name' => __( 'Life Status', 'your-text-domain' ),
'id' => $prefix . 'life-status',
'type' => 'taxonomy_advanced',
'taxonomy' => ['life-status'],
'field_type' => 'radio_list',
'required' => true,
'admin_columns' => 'after title',
'columns' => 4,
'tooltip' => [
'icon' => '',
'position' => 'top',
'content' => 'If "Yes," this person will be marked "private" and will not show on publicly viewable pages.',
],
'before' => __( '</br>', 'your-text-domain' ),
'visible' => [
'when' => [['name-type', 'contains', 311]],
'relation' => 'or',
],
Hi,
Can you please try to deactivate all plugins except Meta Box, MB extensions and switch to the standard theme of WordPress (Twenty TwentyTwo) and recheck this issue? I do not see that issue on my demo site.
Thanks, I tried that and it didn't work. Then, I noticed I had used the same slug (name-type) for the taxonomy and the advanced custom field. I changed the slug for the advanced custom field and now it works.