Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#5245 closed enhancement (fixed)

Get_terms more general sorting in taxonomy.php

Reported by: michelwp Owned by: ryan
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: terms sorting taxonomy
Focuses: Cc:


taxonomy is a powerful tool than can be used not only for category, post_tag or link_category. I test it to develop multilingual set (theme + plugin) and create language and dictionary taxonomies... Some small bugs was detected (#5230, #5240). To reuse standard stable scripts, it will be good if sorting can be set not only for count, name or term_id but also for slug and why not for term_group.

current code

if ( 'count' == $orderby )
		$orderby = 'tt.count';
	else if ( 'name' == $orderby )
		$orderby = 't.name';
		$orderby = 't.term_id';

expected code

if ( 'count' == $orderby )
		$orderby = 'tt.count';
	else if ( 'name' == $orderby )
		$orderby = 't.name';
	else if ( 'slug' == $orderby )
		$orderby = 't.slug';
	else if ( 'term_group' == $orderby )
		$orderby = 't.term_group';
		$orderby = 't.term_id';

Hope it will be useful for other developers.

Attachments (2)

taxo_diff071023.diff (466 bytes) - added by michelwp 8 years ago.
5245-2.diff (559 bytes) - added by andy 8 years ago.

Download all attachments as: .zip

Change History (6)

@michelwp8 years ago

comment:1 @ryan8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6284]) Add option for ordering retrieved terms by slug or term_group. Props michelwp. fixes #5245

comment:2 @andy8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.3 to 2.5

should also apply to wp_get_object_terms()

patch attached

@andy8 years ago

comment:3 @andy8 years ago

  • Owner changed from anonymous to ryan
  • Status changed from reopened to new

comment:4 @ryan8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6843]) Add more sort options to wp_get_object_terms(). Props andy. fixes #5245

Note: See TracTickets for help on using tickets.