Inconsistent return values in get_category_link and get_tag_link
|Reported by:||nacin||Owned by:|
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: ,  (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).
Change History (19)
- Resolution fixed deleted
- Status changed from closed to reopened