'pre-materialized subquery' transition for better SQL performance. $terms = implode( ',', array_map( 'absint', $clause['terms'] ) ); return array( 'join' => array( '' ), 'where' => array( "$this->primary_table.$this->primary_id_column IN ( SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN ( $terms ) )" ), ); } }