WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13797 closed defect (bug) (worksforme)

get_terms orderby none bug

Reported by: thomask Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.0
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

get_terms returns nothing when using urderby 'none' as per http://codex.wordpress.org/Function_Reference/get_terms
it should sort terms by id
the problem is this code in taxonomy.php

 880      else if ( 'none' == $_orderby )
 881          $orderby = '';
 882      elseif ( empty($_orderby) || 'id' == $_orderby )
 883          $orderby = 't.term_id';

easiest repair would be probably

 880      --- delete ---
 881      --- delete ---
 882      elseif ( empty($_orderby) || 'none' == $_orderby || 'id' == $_orderby )
 883          $orderby = 't.term_id';

Change History (2)

comment:1 ryan4 years ago

It works fine here. wp_get_nav_menus() does this. Ordering by t.term_id when you don't care about order can mean a pointless filesort for some taxonomy queries.

comment:2 nacin4 years ago

  • Milestone 3.0 deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.