I am filtering custom post types using ajax. I am able to filter using single taxonomy but how to filter results with multiple taxonomies.
This is the query i tried:
Code:
$args=array('orderby'=>'date','post_status'=>'publish');
//sort by bank if isset
if(isset($_POST['bank']))
{
$args['tax_query']=array(
array(
'taxonomy'=>'banks',
'field'=>'id',
'terms'=>$_POST['bank']
)
);
}
if(isset($_POST['card_type']))
{
$args['tax_query']=array(
'relation'=>'AND',
array(
'taxonomy'=>'cardtype',
'field'=>'id',
'terms'=>$_POST['card_type']
)
);
}
$query=new WP_Query($args);
But it only shows result with filtering from one taxonomy not both.