Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic Conditional Logic Custom Taxonomy

This topic contains 11 replies, has 3 voices, and was last updated by  Max@powdersky.com 3 months, 3 weeks ago.

  • Creator
    Topic
  • #10182

    Max@powdersky.com
    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

Viewing 10 replies - 1 through 10 (of 11 total)
  • Author
    Replies
  • #10186

    meta_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
    Participant

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

    #10274

    Anh 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
    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 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
    Participant

    Nope unfortunately not:

           'visible' => array( 'slug:tax_query[_property_destinations]', 'contains', 'france' ),
    
    #10630

    Max@powdersky.com
    Participant

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

    #10641

    Anh 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
    Participant

    Thanks Anh

    #10660

    Anh 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 ) ),

Viewing 10 replies - 1 through 10 (of 11 total)

The topic ‘Conditional Logic Custom Taxonomy’ is closed to new replies.