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 ?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.