[wp-trac] [WordPress Trac] #16567: Can't create single-character categories
WordPress Trac
wp-trac at lists.automattic.com
Wed Feb 16 03:59:11 UTC 2011
#16567: Can't create single-character categories
-------------------------------------+------------------------------
Reporter: jeffreymcmanus | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.0.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+------------------------------
Comment (by garyc40):
In case someone wonders why "Uncategorized" is output, it's because the
return value of {{{term_exists()}}} can also be an array if a taxonomy is
specified (`wp-includes/taxonomy.php:1438`). `wp_terms_checklist()` later
casts this value as an `int`, making it `1` because it's an array. As a
result, what you get is whatever category has the ID 1 (in this case,
Uncategorized).
By the way, the inline documentation of `term_exists()` states that:
{{{
@return mixed Get the term id or Term Object, if exists.
}}}
Judging from the code I see, the return value could only be either an
associative array, or an integer, but never a term object. Or did I miss
something?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16567#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list