Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在wordpress中按get_term_meta对术语进行排序_Wordpress_Taxonomy_Term_Taxonomy Terms - Fatal编程技术网

是否可以在wordpress中按get_term_meta对术语进行排序

是否可以在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

让我们看一个my args的示例:

$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);

对不起,我迟到了。谢谢你的回复。对不起,我迟到了。谢谢你的回复