Conditional Logic Custom Taxonomy
Support › MB Conditional Logic › Conditional Logic Custom Taxonomy
- This topic has 11 replies, 3 voices, and was last updated 8 years ago by
[email protected].
-
AuthorPosts
-
June 13, 2018 at 9:27 PM #10182
[email protected]
ParticipantHi,
I have used this for a custom taxonomy but it doesn't seem to be working, anything I am clearly doing wrong or anything I need to include?
array( 'name' => 'Off Market Property?', 'id' => self::$prefix . 'off_market', 'type' => 'checkbox', 'tab' => 'general', 'visible' => array( 'slug:tax_query[_property_destinations]', 'in', array(7,9) ), ),Thanks
June 14, 2018 at 12:28 AM #10186meta_gecko
ParticipantI came here to ask the same question. The conditional show/hide doesn't seem to work on the taxonomy select fields, and checkboxes.
June 19, 2018 at 5:35 PM #10254[email protected]
ParticipantSorry anyone have an answer to this as have a project that needs this implemented.
June 20, 2018 at 8:42 PM #10274Anh Tran
KeymasterHi Max,
Can you try:
1 - Changing from number
7,9to string'7','9'? Or
2 - Using the term slugs instead of id?July 9, 2018 at 11:18 PM #10501[email protected]
ParticipantHi Anh,
Sorry for the late reply I have been away the last 2 weeks. I have just tried both and no luck with either.
Just to confirm this will show the field if in any of those categories?
Thanks
July 11, 2018 at 4:05 PM #10514Anh Tran
KeymasterYes, that's what the condition says. However, I think the problem might be: the value of a taxonomy is always an array (as we can select multiple terms to assign to a post). So it's not correct to says one array "in" another array. Can you try "contains" one value, and add another condition for the other value?
July 12, 2018 at 9:08 PM #10553[email protected]
ParticipantNope unfortunately not:
'visible' => array( 'slug:tax_query[_property_destinations]', 'contains', 'france' ),July 19, 2018 at 4:15 PM #10630[email protected]
ParticipantSorry anything else on this would it be worth trying to create a custom callback?
July 20, 2018 at 4:20 PM #10641Anh Tran
KeymasterHi Max,
Let me check it again. In the worst case, I think a custom callback can be used.
July 20, 2018 at 10:01 PM #10647[email protected]
ParticipantThanks Anh
July 23, 2018 at 9:54 AM #10660Anh Tran
KeymasterHi Max,
I found the bug. It's the documentation bug :(. The correct param should be
tax_input, nottax_query. This is the correct rule:'visible' => array( 'tax_input[_property_destinations]', 'in', array( 7, 9 ) ),July 23, 2018 at 5:16 PM #10668[email protected]
ParticipantAh perfect thank Anh! Sorry I can't see this in the documentation glad to have it sorted now though thanks so much.
-
AuthorPosts
- The topic ‘Conditional Logic Custom Taxonomy’ is closed to new replies.