@Bainternet: Thanks! I had to alter the function slightly because it wasn't working (some typos). The only problem now is that the term count is off. The count isn't taking the post type into consideration so I don't think you can use get_terms() in this. function get_terms_by_post_type($post_type,$taxonomy,$fields='all',$args){ $q_args = array( 'post_type' => (array)$post_type, 'posts_per_page' => -1 ); $the_query = new WP_Query( $q_args ); $terms = array(); while ($the_query->have_posts()) { $the_query->the_post(); global $post; $current_terms = get_the_terms( $post->ID, $taxonomy); foreach ($current_terms as $t){ //avoid duplicates if (!in_array($t,$terms)){ $terms[] = $t; } } } wp_reset_query(); //return array of term objects if ($fields == "all") return $terms; //return array of term ID's if ($fields == "ID"){ foreach ($terms as $t){ $re[] = $t->term_id; } return $re; } //return array of term names if ($fields == "name"){ foreach ($terms as $t){ $re[] = $t->name; } return $re; } // get terms with get_terms arguments if ($fields == "get_terms"){ $terms2 = get_terms( $taxonomy ); //echo '<pre>';print_r($terms2);echo '</pre>'; foreach ($terms as $t){ if (in_array($t,$terms2)){ $re[] = $t; } } return $re; } }