[wp-trac] Re: [WordPress Trac] #6952: non-latin category names not alpha sorted (broken in 2.5.1)

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 12 19:47:28 GMT 2009


#6952: non-latin category names not alpha sorted (broken in 2.5.1)
--------------------------+-------------------------------------------------
 Reporter:  jeremyclarke  |        Owner:  jeremyclarke
     Type:  defect (bug)  |       Status:  new         
 Priority:  normal        |    Milestone:  2.9         
Component:  General       |      Version:  2.6         
 Severity:  normal        |   Resolution:              
 Keywords:  has-patch     |  
--------------------------+-------------------------------------------------
Comment (by jeremyclarke):

 In case someone finds this and wants the plugin code solution, this works
 for me:

 {{{

 // --------------------------------------------
 // Refilter fetched terms alphabetically in PHP
 // --------------------------------------------
 //
 // Needed to ensure ar/bn etc have alpha sorted
 // cats despite some failure in mysql or something
 //
 // jer wrote a patch to wp but it was denied
 //
 // the filter:  $terms = apply_filters('get_terms', $terms, $taxonomies,
 $args);
 // $terms is the fetched terms, $taxonomies is like category or tags,
 passed into get_terms,
 // $args is the mixed arguments passed into get_terms or else defaults
 from the function
 //

 function gv_filter_get_terms($terms, $taxonomies, $args) {
         // name is default order, but check in case we are running custom
 checks
         if ( 'name' == $args['orderby'] )
                 usort( $terms, '_usort_terms_by_name' ); // usort func is
 part of wp core
         reset ( $terms );
         return $terms;
 } // gv_filter_get_terms()

 add_filter('get_terms', 'gv_filter_get_terms', 10, 3);
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6952#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list