I have some results from a web form. I'm working with WP and I get a lot of term_id (from different taxonomy). In the frontend the form is "dynamic" for each kind of taxonomy (and i dont know before how many they are), I made a multiselect (all select have same NAME ex: terms[] ). When I process the term_IDs after form Submit I check each term_Id and put it in the right array. EX:
$option = isset($_POST['terms']) ? $_POST['terms'] : false;
if ($option) {
$sql = "SELECT term_id,taxonomy FROM wp_term_taxonomy WHERE term_id IN (".implode(',',$option).") ";
$term_tax = $wpdb->get_results($sql);//print_r($option); exit();
foreach ($term_tax as $tt)
{
$global[$tt->taxonomy][] = $tt->term_id;
}
So in the end I have an array with 1 or N arrays. For each sub-array i have to do a nested cycle
EX: after process terms i have $gloabl[category] and $global[tag] I need to do
foreach($global[category] as $t)
{
foreach($global[tag] as $x)
{
//do query with $t and $x
}
}
I need to do a query with all combinations of term_ids for each subarray dynamically.