Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Testing out WP_TAX_Query
- *
- * @link: http://stackoverflow.com/a/21435355/2078474
- */
- $tax_query = array();
- $tax_query[0] = array(
- 'taxonomy' => 'category',
- 'terms' => array( 65 ),
- 'field' => 'term_id',
- 'include_children' => 1
- );
- $t = new WP_TAX_Query( $tax_query );
- print_r( $t->get_sql( $GLOBALS['wpdb']->posts, 'ID' ) );
- ?>
- Results:
- Array
- (
- [join] => INNER JOIN wp_term_relationships ON (tfl_posts.ID = wp_term_relationships.object_id)
- [where] => AND ( wp_term_relationships.term_taxonomy_id IN (15,70,75) )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement