What is the best method to count the number of posts in a post type that have a particular term? I don't believe
get_posts accepts a term query and I have had no luck with
new WP_Query, though I might be doing something wrong.
$posts = get_posts( array( 'post_type' => 'inventory', array( 'taxonomy' => 'status', 'terms' => 'in-stock', 'field' => 'slug' ), ) ); $count = count( $posts ); echo $count;