[wp-trac] [WordPress Trac] #21681: Add "order" parameter for get_taxonomies()

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 24 14:51:54 UTC 2012


#21681: Add "order" parameter for get_taxonomies()
-----------------------------+----------------------
 Reporter:  acsnaterse       |       Owner:
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Taxonomy         |     Version:  3.4.1
 Severity:  normal           |  Resolution:  wontfix
 Keywords:                   |
-----------------------------+----------------------
Changes (by scribu):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 You need to keep in mind that get_taxonomies() just filters a PHP array;
 there's no SQL involved.

 So, if you want a custom order, just do this:

 {{{
 $taxonomy_names = array( 'taxonomy_b', 'taxonomy_a', ... );

 $taxonomy_objects = array();
 foreach ( $taxonomy_names as $tax_name ) {
   $taxonomy_objects[] = get_taxonomy( $tax_name );
 }
 }}}

 For ordering by title, you can use usort() and so forth; it's just PHP.

 And, since there isn't a clear and common use-case for this, I don't think
 it would be useful to have in Core.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21681#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list