[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 07:04:56 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:                |
--------------------------+------------------------------

Comment (by mikeschinkel):

 Replying to [comment:11 dd32]:
 > 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.

 For the record, my example showing `'1'` was for simplicity of example; my
 use-cases have been being returned as a string from something else, like
 `$_GET['term_id']`.

 > 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)

 WordPress can't force `$_GET['term_id']` to return a numeric.  Sure the
 developer can cast it as `(int)`, but they have to know that it needs to
 be cast; hence the crux of the problem.

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


More information about the wp-trac mailing list