$wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
Do a tax-query and then count the result. No need for a custom query with dozens of JOINS. $posts = new WP_Query( array( ‘post_type’ => ‘MYPOSTTYPE’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘TAX_1’, ‘field’ => ‘slug’, ‘terms’ => array( ‘TERM_TAX_1’ ), ‘operator’ => ‘IN’ ), array( // etc. ) ), ‘post_status’ => ‘publish’ ); prinft( … Read more