I have a view that has a "Has taxonomy term ID" contextual filter and also a nid contextual filter.
I execute this view programmatically, but I need to pass also multiple values for the taxonomy contextual filter.
I tried this:
$view->set_arguments(array($tid, $nid)); $view->execute();
and it works only if $tid is only a number.
I tried to put more than one tid using "+", but it doesn't work. (example 3+5+8)
Any idea on how I can set a multiple taxonomy argument programmatically? thank you in advance
I found a solution, but I don't like it. I removed the filter from contextual filter and I added an exposed filter for the same field. Then I changed the code in this way:
$view->set_arguments(array($nid)); $view->exposed_input['field_myfield_tid'] = $tid; //note that $tid is an array of tid $view->execute();