Conditional Logic Based On Taxonomy Term Slug Or Name

Support MB Conditional Logic Conditional Logic Based On Taxonomy Term Slug Or NameResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40628
    James CooperJames Cooper
    Participant

    Is there a way to set up the conditional logic for a taxonomy based on the selected term's slug or name instead of its ID?

    Thank you!

    #40638
    PeterPeter
    Moderator

    Hello,

    Yes, it is possible. Please read more on the documentation https://docs.metabox.io/extensions/meta-box-conditional-logic/#using-with-taxonomies

    #40652
    James CooperJames Cooper
    Participant

    Great! Thanks for pointing me in the right direction!

    #40796
    James CooperJames Cooper
    Participant

    Does the MB Builder not support adding tax_input[taxonomy_slug] as the first parameter of the conditional logic fields? I try to add it, and it does not work.

    This works as expected using the builder:

    
                    'visible'     => [
                        'when'     => [['profession', 'in', ['31', '32']]],
                        'relation' => 'or',
                    ],
    

    This does not work using the builder (where taxonomy_slug = 'profession'):

    
                    'visible'     => [
                        'when'     => [['tax_input[profession]', 'in', ['31', '32']]],
                        'relation' => 'or',
                    ],
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.