Start by creating the arguments, but leaving tax_query
empty:
$args = array(
'post_type' => 'watches',
'tax_query' => array(),
);
Then in your loop you can add to tax_query
with $args['tax_query'][] =
:
$args = array(
'post_type' => 'watches',
'tax_query' => array(),
);
foreach ( $things as $thing ) {
$args['tax_query'][] = array(
'taxonomy' => $thing['taxonomy'],
'field' => 'slug',
'terms' => $thing['term'],
);
}
Exactly what you’re looping over will likely affect what $things
is and how you’d use it, but you didn’t include that information in your question so I can’t help beyond what I’ve already put.