Make get_terms() orderby case insensitive, props DD32, fixes #9906

git-svn-id: https://develop.svn.wordpress.org/trunk@11428 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-05-22 12:29:32 +00:00
parent 29ed683636
commit 8017f27e5a
2 changed files with 8 additions and 7 deletions

View File

@ -332,7 +332,7 @@ function category_description( $category = 0 ) {
function wp_dropdown_categories( $args = '' ) { function wp_dropdown_categories( $args = '' ) {
$defaults = array( $defaults = array(
'show_option_all' => '', 'show_option_none' => '', 'show_option_all' => '', 'show_option_none' => '',
'orderby' => 'ID', 'order' => 'ASC', 'orderby' => 'id', 'order' => 'ASC',
'show_last_update' => 0, 'show_count' => 0, 'show_last_update' => 0, 'show_count' => 0,
'hide_empty' => 1, 'child_of' => 0, 'hide_empty' => 1, 'child_of' => 0,
'exclude' => '', 'echo' => 1, 'exclude' => '', 'echo' => 1,

View File

@ -671,17 +671,18 @@ function &get_terms($taxonomies, $args = '') {
return $cache; return $cache;
} }
if ( 'count' == $orderby ) $_orderby = strtolower($orderby);
if ( 'count' == $_orderby )
$orderby = 'tt.count'; $orderby = 'tt.count';
else if ( 'name' == $orderby ) else if ( 'name' == $_orderby )
$orderby = 't.name'; $orderby = 't.name';
else if ( 'slug' == $orderby ) else if ( 'slug' == $_orderby )
$orderby = 't.slug'; $orderby = 't.slug';
else if ( 'term_group' == $orderby ) else if ( 'term_group' == $_orderby )
$orderby = 't.term_group'; $orderby = 't.term_group';
elseif ( empty($orderby) || 'id' == $orderby ) elseif ( empty($_orderby) || 'id' == $_orderby )
$orderby = 't.term_id'; $orderby = 't.term_id';
$orderby = apply_filters( 'get_terms_orderby', $orderby, $args ); $orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
$where = ''; $where = '';