get_tax_sql
Given a taxonomy query, generates SQL to be appended to a main query.
Description
Returns (array)
Parameters (3)
- 0. $tax_query (array)
- A compact tax query
- 1. $primary_table (string)
- The primary table.
- 2. $primary_id_column (string)
- The primary id column.
Usage
if ( !function_exists( 'get_tax_sql' ) ) { require_once ABSPATH . WPINC . '/taxonomy.php'; } // A compact tax query $tax_query = array(); // The primary table. $primary_table = ''; // The primary id column. $primary_id_column = ''; // NOTICE! Understand what this does before running. $result = get_tax_sql($tax_query, $primary_table, $primary_id_column);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/taxonomy.php
- function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
- $tax_query_obj = new WP_Tax_Query( $tax_query );
- return $tax_query_obj->get_sql( $primary_table, $primary_id_column );
- }