首先,你真的不应该使用query_posts
为此,请使用get\\u posts或WP\\u Query和secondtax_query
接受数组数组
抄本:
tax\\u query采用tax查询参数数组(采用数组数组)
因此:
$terms=get_terms(\'tax_name\');
$request=array();
foreach((array)$terms as $t)
$request[]=$t->slug;
$tax_q = new WP_Query(
array(
\'post_type\' => \'post\',
\'posts_per_page\' => 1,
\'tax_query\' => array(
array(
\'taxonomy\' => \'tax_name\',
\'field\' => \'slug\',
\'terms\' => $request,
)
)
)
);
while ( $tax_q->have_posts() ): $tax_q->the_post();