我有一个数组来存储分类法和查询术语,但我不能使用foreach在tax\\u查询中循环我的数组。我拿到了505内线。
$query = array(
\'post_type\' => $post_type,
\'posts_per_page\' => -1,
);
$query[\'tax_query\'] = array(
\'relation\' => \'OR\',
foreach($taxonomy_arr as $t):
array(
\'taxonomy\' => $t[taxonomy],
\'terms\' => $t[value],
\'field\' => \'slug\',
),
endforeach;
);
foreach或查询本身可以正常工作,但在内部循环时无法工作。请给我一些建议。谢谢