I create metabox serial_language
with ACP plugin into custom taxonomy name is serial
.
And I want to get only terms, in which custom field value is english, arabic
.
How to get only terms which have custom fields value english or arabic
?
$wcatTerms = array(
'get_terms' => 'serial',
'hide_empty' => 0,
'parent' =>0,
'tax_query' => array(
'relation' => 'AND',
array(
'get_terms' => 'serial',
'field' => 'serial_language',
'value' => array( 'english', 'arabic' ),
)
));
foreach($wcatTerms as $wcatTerm) :
echo '<a href="' .get_term_link( $wcatTerm->slug, $wcatTerm->taxonomy ). '">' .$wcatTerm->name. '</a>';
endforeach;
I create metabox serial_language
with ACP plugin into custom taxonomy name is serial
.
And I want to get only terms, in which custom field value is english, arabic
.
How to get only terms which have custom fields value english or arabic
?
$wcatTerms = array(
'get_terms' => 'serial',
'hide_empty' => 0,
'parent' =>0,
'tax_query' => array(
'relation' => 'AND',
array(
'get_terms' => 'serial',
'field' => 'serial_language',
'value' => array( 'english', 'arabic' ),
)
));
foreach($wcatTerms as $wcatTerm) :
echo '<a href="' .get_term_link( $wcatTerm->slug, $wcatTerm->taxonomy ). '">' .$wcatTerm->name. '</a>';
endforeach;
Try This:
$args = array(
'hide_empty' => false,
'relation' => 'OR',
array(
'key' => 'serial_language',
'value' =>'english',
'compare' => 'LIKE'
),
array(
'key' => 'serial_language',
'value' =>'arabic',
'compare' => 'LIKE'
),
'taxonomy' => 'serial',
);
$terms = get_terms( $args );
hope this will help