Opened 11 years ago
Closed 11 years ago
#33565 closed enhancement (fixed)
Add option to pass an array of objects or IDs to $current_category in wp_list_categories()
| Reported by: | vilkatis | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Taxonomy | Version: | 4.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
I needed to pass an array of objects to $current_category a couple of times, and had to make a custom walker for that.
Would be nice if it was a part of core.
Attachments (3)
Change History (12)
#3
follow-up:
↓ 7
@
11 years ago
I added two unit tests that I could think of , don't know if that's enough or if I did them right.
I used it for some clients who had products belonging to a couple of categories at the same time , as they wanted all relevant categories to be highlighted in a sidebar menu.
#7
in reply to: ↑ 3
@
11 years ago
- Milestone Awaiting Review → 4.4
Replying to vilkatis:
I added two unit tests that I could think of , don't know if that's enough or if I did them right.
I used it for some clients who had products belonging to a couple of categories at the same time , as they wanted all relevant categories to be highlighted in a sidebar menu.
Thanks, this seems sensible.
Looking at it more closely, I don't think that it's a great idea for us to start accepting term objects in addition to term IDs. There aren't many places where we do this for terms (at least not that I can think of). When and if we have a proper WP_Term object, perhaps we can start thinking of retrofitting functions to accept it.
I've simplified the patch and the unit tests in 33565.2.diff.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch seems OK to me. Any chance you could take a swing at writing a few unit tests for it?
Out of curiosity, what is the use case for having more than one current_category?