是否可以在wordpress中按get_term_meta对术语进行排序
让我们看一个my args的示例:是否可以在wordpress中按get_term_meta对术语进行排序,wordpress,taxonomy,term,taxonomy-terms,Wordpress,Taxonomy,Term,Taxonomy Terms,让我们看一个my args的示例: $args = array( 'orderby' . => $orderby, 'number' => $per_page, 'offset' => $offset, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array
$args = array(
'orderby' . => $orderby,
'number' => $per_page,
'offset' => $offset,
'exclude' => array(),
'exclude_tree' => array(),
'include' => array(),
'fields' => 'all',
'hierarchical' => true,
'child_of' => 0,
'pad_counts' => false,
'offset' => $offset,
'terms' => $term->slug,
'cache_domain' => 'core'
);
如果我有一个像这样的术语保存在数据库中
$yellow = get_term_meta($term->term_id,'product_yellow',true);
是否可以仅使用黄色术语对分类法进行排序?您的意思是这样的吗
$args = array(
'meta_query' => array(
array(
'key' => $term->term_id,
'value' => 'product_yellow',
'compare' => 'LIKE'
)
)
);
这会将查询的范围限制为特定的元值。您的意思是这样的吗
$args = array(
'meta_query' => array(
array(
'key' => $term->term_id,
'value' => 'product_yellow',
'compare' => 'LIKE'
)
)
);
这会将查询范围限制为特定的元值。是的,这是可能的
$args = array(
'taxonomy' => 'post_tag',
'meta_key' => 'product_yellow',
'orderby' => 'meta_value', // use 'meta_value_num' if the value type of this meta is numeric.
'order' => 'DESC',
);
$terms = get_terms($args);
是的,有可能
$args = array(
'taxonomy' => 'post_tag',
'meta_key' => 'product_yellow',
'orderby' => 'meta_value', // use 'meta_value_num' if the value type of this meta is numeric.
'order' => 'DESC',
);
$terms = get_terms($args);
对不起,我迟到了。谢谢你的回复。对不起,我迟到了。谢谢你的回复