Support

Account

Home Forums Feature Requests Conditional Logic using Taxonomy field Reply To: Conditional Logic using Taxonomy field

  • You have to define your options as “value : label, where value is then your taxonomy id. For example, for Sex I have 3 options:
    1 : Woman
    2 : Man
    3 : Trans
    This returns an id.

    Whereas if you define it like this:
    woman
    man
    trans

    or

    woman : [anything except the word woman]
    man : [anything except the word man]
    trans : [anything except the word trans]

    then it returns a string.

    So it depends on what value $posted_roles is.
    If it’s an ID, you need to change this
    $term_id = get_term_by( 'name', $posted_roles, 'asproducts_cats' );
    to
    $term_id = get_term_by( 'id', $posted_roles, 'asproducts_cats' );

    which should then match your taxonomy id of course.

    So how did you define your options ?