質問: get_posts(array( 'post_type' => 'page', 'numberposts' => -1, 'tax_query' => array( array( 'taxonomy' => 'taxonomy-name', 'field' => 'id', 'terms' => 1 // where term_id of term 1 is "1". ) ) ); また、1.1条と1.2条が割り当てられている投稿もあります。ありがとう。
回答: 先日出会ったばかりです。$tax = 'music'; $oterm = 'pop'; $term = get_term_by('slug', $oterm, $tax); $termchildren = get_term_children($term->term_id, $tax); $wp_query = new wp_query(); $wp_query->query( array( 'posts_per_page' => '5', 'tax_query' => array( array( 'taxonomy' => $tax, 'field' => 'slug', 'terms' => $oterm ), array( 'taxonomy' => $tax, 'field' => 'id', 'terms' => $termchildren, 'operator' => 'not in' ) ) ) ); ソース: http://return-true.com/2011/08/wordpress-display-posts-from-a-term-without-displaying-posts-from-child-terms/