Ticket #5245 (closed enhancement: fixed)

Opened 1 year ago

Last modified 10 months ago

Get_terms more general sorting in taxonomy.php

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

Description

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';
	else
		$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';
	else
		$orderby = 't.term_id';

Hope it will be useful for other developers.

Attachments

taxo_diff071023.diff (466 bytes) - added by michelwp on 10/23/07 12:37:16.
5245-2.diff (0.5 kB) - added by andy on 02/14/08 04:12:22.

Change History

10/23/07 12:37:16 changed by michelwp

  • attachment taxo_diff071023.diff added.

10/23/07 16:39:04 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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

02/14/08 04:11:52 changed by andy

  • status changed from closed to reopened.
  • version changed from 2.3 to 2.5.
  • resolution deleted.

should also apply to wp_get_object_terms()

patch attached

02/14/08 04:12:22 changed by andy

  • attachment 5245-2.diff added.

02/14/08 04:15:46 changed by andy

  • owner changed from anonymous to ryan.
  • status changed from reopened to new.

02/14/08 05:40:19 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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