Conditional Logic, Advanced Taxonomy Fields with Radio buttons
Support › MB Conditional Logic › Conditional Logic, Advanced Taxonomy Fields with Radio buttonsResolved
- This topic has 2 replies, 2 voices, and was last updated 2 years, 8 months ago by
Cynthia Conser.
-
AuthorPosts
-
September 5, 2022 at 6:59 AM #38174
Cynthia Conser
ParticipantI 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 (MB Builder), I am trying to set the visibility of the second advanced taxonomy field as follows.
Visible when any conditions match
name-type contains 311However, 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 “MB Conditional Logic” in the Advanced Operators section (see code block below).
What I have tried:
- Changing conditions from "any" to "all,"
- Other operators, including =, in, and match,
- Changing the field types to simple custom fields with radio buttons and using the recommended settings for custom fields. This worked, but I need to use taxonomy terms.
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', ],
September 5, 2022 at 11:09 AM #38175Long Nguyen
ModeratorHi,
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.
September 5, 2022 at 10:52 PM #38184Cynthia Conser
ParticipantThanks, 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.
-
AuthorPosts
- You must be logged in to reply to this topic.