[wp-trac] [WordPress Trac] #21760: Allow get_term() to accept string as first argument

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 31 21:34:12 UTC 2012


#21760: Allow get_term() to accept string as first argument
----------------------------+------------------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Taxonomy        |     Version:  2.3
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------

Comment (by nacin):

 Cache keys are cast to strings. That means there would be a collision of
 the term_id of 1, the slug of '1', and the name of '1'. Even without the
 casting woes, slug and name would conflict.

 For users, we handle this with separate cache buckets: users (by ID),
 userlogins, useremail, and userslugs.

 This can just as easily be handled in the same bucket with prefixes - IDs
 are stored as is, login-$login, email-$email, slug-$slug. Or for terms,
 you'd have IDs, slug-$slug, name-$name.

 update_term_cache() should set slug and name cache keys, in addition to
 ID, and that should then be leveraged by get_term_by() and friends.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21760#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list