admin管理员组文章数量:1130349
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;
Share
Improve this question
asked Dec 14, 2018 at 13:48
F.AF.A
255 bronze badges
1 Answer
Reset to default 1Try 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
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;
Share
Improve this question
asked Dec 14, 2018 at 13:48
F.AF.A
255 bronze badges
1 Answer
Reset to default 1Try 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
本文标签: custom fieldPrint terms with taxonomy and metabox value
版权声明:本文标题:custom field - Print terms with taxonomy and metabox value 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749099514a2315775.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论