Opened 9 years ago
Closed 9 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 |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
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
@
9 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.
#4
@
9 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 33767:
#7
in reply to:
↑ 3
@
9 years ago
- Milestone changed from Awaiting Review to 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.
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?