Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6523 closed defect (bug) (invalid)

get_terms() bug

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords:
Focuses: Cc:

Description

This plugin:

http://wordpress.org/extend/plugins/my-category-order/installation/

requires that one change the taxonomy.php file...

because there's a missing case in get_terms()

Change History (6)

#1 @Denis-de-Bernardy
17 years ago

it should go like this:

	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 if ( 'term_order' == $orderby )
		$orderby = 'tr.term_order';
	else
		$orderby = 't.term_id';

(the term_order case is missing)

#2 @lloydbudd
17 years ago

Denis-de-Bernardy, are you able to attach patches? Please see http://codex.wordpress.org/Reporting_Bugs#Patching_Bugs

#3 @Denis-de-Bernardy
17 years ago

I'm afraid not... I run a customized version of WP and I've set up a dedicated svn for it. The patches I can generate won't work any more with your svn than the ones you're generating on mine. In the future, I'll try to set it up with WP as an external reference. Until then, I'm stuck with reporting bugs and findings. ;-)

Speaking of which, the above fix is not the only necessary change. The My Category Order plugin doesn't work as documented. There's a db query beneath the above code in get_terms() that also needs an extra table to avoid DB errors. And then, you get duplicate results all over the place.

I stopped looking into the issue upon getting the latter, as I had more important stuff to care about at the moment.

Still, the WP DB schema has a term_order field that is just asking to become useful. Maybe the plugin's developer will come up with the fix?

D.

#4 @lloydbudd
17 years ago

Denis-de-Bernardy, surely it's trivial to maintain a clean WordPress check out to create your patches verses. The core developers being able to see the colorized diffs makes it more likely that your fixes get incorporated quickly.

#5 @Otto42
17 years ago

  • Resolution set to invalid
  • Severity changed from major to normal
  • Status changed from new to closed

term_order is in the term_relationships table. Adding it to a possible order field for get_terms doesn't make any sense, because get_terms gets terms by taxonomy, not by a relationship with a post. The SELECT statement in get_terms does not even include a JOIN to the term_relationships table or a reference to it as "tr".

Marking this as invalid, because it makes no sense.

#6 @lloydbudd
17 years ago

  • Milestone 2.5.1 deleted
Note: See TracTickets for help on using tickets.