Support

Account

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 ...
      }
    }
    // ...