Conditional Logic Custom Taxonomy

Support MB Conditional Logic Conditional Logic Custom Taxonomy

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #10182
    Max@powdersky.com[email protected]
    Participant

    Hi,

    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

    #10186
    meta_geckometa_gecko
    Participant

    I came here to ask the same question. The conditional show/hide doesn't seem to work on the taxonomy select fields, and checkboxes.

    #10254
    Max@powdersky.com[email protected]
    Participant

    Sorry anyone have an answer to this as have a project that needs this implemented.

    #10274
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    Can you try:

    1 - Changing from number 7, 9 to string '7', '9'? Or
    2 - Using the term slugs instead of id?

    #10501
    Max@powdersky.com[email protected]
    Participant

    Hi 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

    #10514
    Anh TranAnh Tran
    Keymaster

    Yes, 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?

    #10553
    Max@powdersky.com[email protected]
    Participant

    Nope unfortunately not:

           'visible' => array( 'slug:tax_query[_property_destinations]', 'contains', 'france' ),
    
    #10630
    Max@powdersky.com[email protected]
    Participant

    Sorry anything else on this would it be worth trying to create a custom callback?

    #10641
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    Let me check it again. In the worst case, I think a custom callback can be used.

    #10647
    Max@powdersky.com[email protected]
    Participant

    Thanks Anh

    #10660
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    I found the bug. It's the documentation bug :(. The correct param should be tax_input, not tax_query. This is the correct rule:

    'visible' => array( 'tax_input[_property_destinations]', 'in', array( 7, 9 ) ),

    #10668
    Max@powdersky.com[email protected]
    Participant

    Ah perfect thank Anh! Sorry I can't see this in the documentation glad to have it sorted now though thanks so much.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Conditional Logic Custom Taxonomy’ is closed to new replies.