#15407 closed defect (bug) (fixed)
get_the_category code duplication
| Reported by: | filosofo | Owned by: | filosofo |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Taxonomy | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
16 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
@
16 years ago
- Resolution fixed
- Status closed → 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
@
16 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
@
16 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
@
16 years ago
- Cc 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
@
16 years ago
- Resolution fixed
- Status closed → reopened
The newly introduced filter's name is plural and inconsistent with the function's name. Suggesting we rename it accordingly.
#13
@
16 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
@
16 years ago
- Resolution → fixed
- Status reopened → 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
@
16 years ago
- Keywords revert removed
- Resolution fixed
- Status closed → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Shouldn't the filter be named 'get_the_category' ?