Home › Forums › Front-end Issues › Need to filter post object by one taxonomy › Reply To: Need to filter post object by one taxonomy
The second parameter for get_sub_field()
is a boolean value that tells ACF whether or not to format the value. The string you entered evaluates to true, so no difference will be seen.
In order to do what you want you will need to something like
// ...
if ( $cast_object) {
// https://codex.wordpress.org/Function_Reference/wp_get_object_terms
$terms = get_object_terms($cast_object->ID, 'cast_crew_category', array('fields' => 'ids'));
if (in_array(83, $terms)) {
// ... the rest of your code here ...
}
}
// ...
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.