I can’t seem to find a way to set the query more than one taxonomy
You already found it, but the problem is, you should have not done this:
$tax_query_array = array('relation' => 'OR');
$speciality_select ? array_push($tax_query_array, ...) : null ;
$query->set( 'tax_query', $tax_query_array);
$tax_query_array = array('relation' => 'OR');
$industry_select ? array_push($tax_query_array, ...) : null ;
$query->set( 'tax_query', $tax_query_array);
.. because the 2nd $query->set()
call overrides the entire tax_query
array that’s set via the 1st $query->set()
call.
And to fix the issue, just remove the 1st $query->set()
call and the 2nd $tax_query_array = array('relation' => 'OR');
, i.e. lines 3 and 5 above.
Also, keep in mind that is_archive()
does not accept any parameters. So if you wanted to check if the query is for a specific post type archive, use is_post_type_archive()
instead, i.e. is_post_type_archive( 'experts' )
.
And.. I don’t think the $keyword ? $keyword : $keyword = null;
is necessary, so I’d just remove that and simply do $query->set('s', $keyword);
.