Given a taxonomy query, generates SQL to be appended to a main query.
<?php get_tax_sql( $tax_query, $primary_table, $primary_id_column ) ?>
<?php $tax_query = array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => array( 'cat-a', 'cat-b' ), ) ); global $wpdb; $tax_sql = get_tax_sql( $tax_query, $wpdb->posts, 'ID' ); ?>
Output depending on the taxonomy query:
Array ( [join] => INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) [where] => AND ( wp_term_relationships.term_taxonomy_id IN (3,4,10,19,25,95) ) )
Since: 3.1.0
get_tax_sql() is located in wp-includes/taxonomy.php540
.