#15407 closed defect (bug) (fixed)
get_the_category code duplication
Reported by: | filosofo | Owned by: | filosofo |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
get_the_category
needlessly duplicates the functionality of get_the_terms
, and it lacks a filter that the corresponding get_the_tags
has.
Attachments (4)
Change History (25)
#2
@
14 years ago
Well, my thought was to be consistent with get_the_tags
, so that the general form would be get_the_[taxonomy]s
The function itself, get_the_category()
, is rather poorly named.
#7
@
14 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
For consistency, the_category() with the_categories()?
These are very commonly used template tags so I'm not sure deprecating them for a pluralization is worth it. We've been fine for 8+ major releases with them as is.
#8
@
14 years ago
I'm not wedded to the name change, but I think the code duplication fix of the original patch should stay.
I also think that get_the_categories
as a filter makes more sense than get_the_category
or the like, because it's filtering an array.
#9
@
14 years ago
And actually, maybe it wouldn't be a bad idea to go with the_categories()
. It's easier to remember, and the Extend theme reviewers will love having the_category()
deprecated so they can smite even more themes. :)
#10
@
14 years ago
- Cc westi added
- Keywords revert added
The name change needs to be reverted - we should and will not rename a function just for the sake of the name being more proper.
#12
follow-up:
↓ 14
@
14 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The newly introduced filter's name is plural and inconsistent with the function's name. Suggesting we rename it accordingly.
#13
@
14 years ago
It makes more sense to name a filter according to the use of the filter rather than its containing function, especially when the function is poorly named.
#14
in reply to:
↑ 12
@
14 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Replying to Denis-de-Bernardy:
The newly introduced filter's name is plural and inconsistent with the function's name. Suggesting we rename it accordingly.
This is intentional.
#16
@
14 years ago
- Keywords revert removed
- Resolution fixed deleted
- Status changed from closed to reopened
After an IRC discussion with Viper007Bond, the issue here is that get_the_terms() may return false. I was trying to prevent issues there, but it may be cast awkwardly into an array(0=>null) which then causes some problems.
Shuffling things around here a bit.
Shouldn't the filter be named 'get_the_category' ?