[wp-trac] [WordPress Trac] #16521: Inconsistent return values in get_category_link and get_tag_link

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 10 18:41:57 UTC 2011


#16521: Inconsistent return values in get_category_link and get_tag_link
--------------------------+-----------------
 Reporter:  nacin         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.1
Component:  General       |    Version:
 Severity:  critical      |   Keywords:
--------------------------+-----------------
 In 3.0, we had very inconsistent parameters and return values in
 get_category_link and get_tag_link.

 get_tag_link() could return WP_Error if the term didn't exist, despite not
 being documented in the phpdoc. But, it also could handle objects as
 $tag_id being passed in, despite being undocumented.

 get_category_link() could return WP_Error if the term didn't exist,
 despite not being documented. But, it could handle objects as $category_id
 being passed in -- only when using pretty permalinks -- despite being
 undocumented.

 get_term_link() did not document that it could return WP_Error. But it
 could also take object|int|string as a $term, and it would work.

 For some time, we just pasted over the issues: [16430], [17341] (doc
 fixes), #16385 (wontfix), #16282 (don't even know),  . But I keep seeing
 sporadic reports in the forums of these functions blowing up themes.
 That's not good.

 As template functions, they should be avoiding WP_Error to begin with.
 Let's prevent get_category_link and get_term_link from returning WP_Error,
 and let's allow object|string|int for $category(_id) and $tag(_id).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16521>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list