[wp-trac] [WordPress Trac] #16469: Cannot pass in ID for get_term_link() if using custom taxonomy

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 7 04:36:06 UTC 2011


#16469: Cannot pass in ID for get_term_link() if using custom taxonomy
--------------------------+------------------------------
 Reporter:  sparkweb      |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  3.0.4
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by dd32):

 >If you pass in a numeric string, is_int() still returns false, while
 is_numeric() returns true. So it's safer to use is_numeric() here.

 is_int != is_numeric in the Term API. Theres the possibility of having
 Numeric slugs.

 The correct fix here, is to verify that ALL term objects being returned
 return the term_id as a integer, that'll fix most of these casting
 problems (ie. It may return a string '1' instead of (int)1)

 If someone passes a (string)'1' in as the term_id, they're doing it wrong,
 OR an API call is returning the data in the incorrect format.

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


More information about the wp-trac mailing list