Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?

Thanks guys. I think I may have found a solution.

What I did:

  • On taxonomy-types.php, get all Items for that type using WP_QUERY.
  • Loop through them, use get_the_terms() to get taxonomy Model for each Item
  • Still in the loop: use PHP’s in_array() function and a $model_ids array for unique Model checking
  • Still in the loop: if the Model is unique, store the Item id in an $item_ids array
  • End that loop
  • Use WP_QUERY to get Items with 'post__in' set to the $item_ids array