[wp-trac] [WordPress Trac] #34996: Ordering taxonomies by term meta

WordPress Trac noreply at wordpress.org
Fri Dec 11 15:37:58 UTC 2015


#34996: Ordering taxonomies by term meta
-------------------------+-----------------------------
 Reporter:  eherman24    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Taxonomy     |     Version:  4.4
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+-----------------------------

Comment (by eherman24):

 @boonebgorges, I just went through and tested passing in a meta query with
 the orderby clause and it doesn't seem to return the terms ordered by term
 meta. I'm not sure it's referencing the _termmeta table properly.


 I have terms setup in the dashboard as such:
 ( Term : Position )
 IT : 1
 Administration : 2
 Community Relations : 3


 {{{
 $terms = get_terms( 'peoplecats', array(
         'meta_query' => array(
                 'position_clause' => array(
                         'key' => 'tax_position',
                         'value' => 0,
                         'compare' => '>='
                 ),
         ),
         'orderby' => 'position_clause',
 ) );
 print_r( $terms );
 }}}

 The returned order is:

 Administrator
 Community Relations
 IT

 Which seems to still be ordering by 'name' instead of the specified custom
 meta `tax_position`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34996#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list