Query by multiple custom taxonomies

I would really appreciate help or any lead.
I have checkboxes with which I’m collecting data for the filters. Here is the code for checking if variable is set:

if ( isset($_GET[‘f’]) && $_GET[‘f’] == ‘1’) {$face = ‘facebook’;} else {$face = ”;}
if ( isset($_GET[‘t’]) && $_GET[‘t’] == ‘1’ ) {$twitter = ‘twitter’;} else {$twitter = ”;}
if ( isset($_GET[‘te’]) && $_GET[‘te’] == ‘1’ ) {$telegram = ‘telegram’;} else {$telegram = ”;}
if ( isset($_GET[‘r’]) && $_GET[‘r’] == ‘1’ ) {$reddit = ‘reddit’;} else {$reddit = ”;}
if ( isset($_GET[‘e’]) && $_GET[‘e’] == ‘1’ ) {$email = ’email’;} else {$email = ”;}
if ( isset($_GET[‘ph’]) && $_GET[‘ph’] == ‘1’ ) {$phone = ‘phone’;} else {$phone = ”;}
if ( isset($_GET[‘b’]) && $_GET[‘b’] == ‘1’ ) {$bitcointalk = ‘bitcointalk’;} else {$bitcointalk = ”;}
if ( isset($_GET[‘k’]) && $_GET[‘k’] == ‘1’ ) {$kyc = ‘kyc’;} else {$kyc = ”;}
if ( isset($_GET[‘y’]) && $_GET[‘y’] == ‘1’ ) {$youtube = ‘youtube’;} else {$youtube = ”;}
if ( isset($_GET[‘l’]) && $_GET[‘l’] == ‘1’ ) {$linkedin = ‘linkedin’;} else {$linkedin = ”;}
if ( isset($_GET[‘eth’]) && $_GET[‘eth’] == ‘1’ ) {$ethereum = ‘ethereum’;} else {$ethereum = ”;}
if ( isset($_GET[‘neo’]) && $_GET[‘neo’] == ‘1’ ) {$neo = ‘neo’;} else {$neo = ”;}
if ( isset($_GET[‘xml’]) && $_GET[‘xml’] == ‘1’ ) {$stellar = ‘stellar’;} else {$stellar = ”;}
if ( isset($_GET[‘waves’]) && $_GET[‘waves’] == ‘1’ ) {$waves = ‘waves’;} else {$waves = ”;}
if ( isset($_GET[‘kmd’]) && $_GET[‘kmd’] == ‘1’ ) {$komodo = ‘komodo’;} else {$komodo = ”;}
if ( isset($_GET[‘own’]) && $_GET[‘own’] == ‘1’ ) {$own = ‘own’;} else {$own = ”;}

I have 2 custom taxonomies: filters and platform. Query works if I’m filtering by only 1 category. But recently I have added the second one (platform). Here is the code I’m trying to use:

$tax_query_args = array(
‘relation’ => ‘OR’,
array(
‘taxonomy’ => ‘filters’,
‘field’ => ‘slug’,
‘terms’ => array ($face, $twitter, $telegram, $reddit, $email, $phone, $bitcointalk, $kyc, $youtube, $linkedin),
‘operator’ => ‘IN’
),

array(
‘taxonomy’ => ‘platform’,
‘field’ => ‘slug’,
‘terms’ => array ($ethereum, $neo, $stellar, $waves, $komodo, $own),
‘operator’ => ‘IN’
),

);

But it doesn’t work. All results are returned.

I would appreciate any help.

Thank you.

Read more here:: Query by multiple custom taxonomies

Leave a Reply

Your email address will not be published. Required fields are marked *