[wp-trac] [WordPress Trac] #15231: get_the_category() used strcmp() which is case sensitive
WordPress Trac
wp-trac at lists.automattic.com
Wed Oct 27 10:57:15 UTC 2010
#15231: get_the_category() used strcmp() which is case sensitive
--------------------------+-------------------------------------------------
Reporter: joehoyle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 3.0
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
I recently ran into an issue with `get_the_category()` returning the array
of categories ordered by Name (which is does by default). However, this
will return different results than `wp_get_object_terms()`, because
`wp_get_object_terms()` used an SQL ORDER BY which (correct me if I am
wrong) will do a case insensitive string compare, whereas using `strcmp()`
is case sensitive, so any categories starting in a lowercase letter will
be but _after_ all capitalized names.
Eg:
{{{
$terms = wp_get_object_terms( $id );
// array( 'Apple, 'iPod', Microsoft' )
$cats = get_the_category( $id );
// array( 'Apple', 'Microsoft', 'iPod' )
}}}
Which seems counterintuitive. Should this be fixed?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15231>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list