I have an array to store taxonomy and term for query, but I can not use foreach to loop my array inside my tax_query. I got 505 internal.
$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;
);
the foreach or the query works fine on its own but does not work when I loop inside. Please give me advice. Thanks