#35156 closed defect (bug) (fixed)
wp_list_categories() does not accept comma-separated IDs for exclude_tree parameter
Reported by: | gblsm | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.4.1 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Taxonomy | Keywords: | fixed-major |
Focuses: | Cc: |
Description
This does not work:
wp_list_categories( array( 'exclude_tree' => '9,10' ) );
as only the category ID=9 and its descendants will be excluded, while ID=10 will be included.
But this works:
wp_list_categories( array( 'exclude_tree' => array( 9, 10 ) ) );
as the categories ID=9, 10 and their descendants will be excluded.
Attachments (2)
Change History (15)
#2
in reply to:
↑ description
@
9 years ago
The reference page of wp_list_categories() says that,
'exclude_tree'
(array|string) Array or comma/space-separated string of term IDs to exclude, along with their descendants. See get_terms().
https://developer.wordpress.org/reference/functions/wp_list_categories/
I also think the behavior reported with this ticket does not match the description of the reference.
#3
@
9 years ago
Applying wp_parse_id_list() instead of the cast “(array)” seems fixing the bug. The patch does it.
#5
follow-up:
↓ 6
@
9 years ago
- Keywords has-patch added
Thanks for the patch, @gblsm. Did you notice this issue because it worked in 4.3 but not in 4.4? It looks like it might be a regression.
#6
in reply to:
↑ 5
@
9 years ago
Replying to boonebgorges:
This issue was reported at https://ja.forums.wordpress.org/topic/157359 by @odmodm then @tg29359 encouraged opening a ticket.
#8
@
9 years ago
- Milestone changed from Awaiting Review to 4.4.1
- Owner set to boonebgorges
- Status changed from new to assigned
Thanks for the patches, @gblsm and @hnle. It does look like this is a 4.4 regression, so let's fix for 4.4.1.
#10
@
9 years ago
- Keywords fixed-major added; has-patch has-unit-tests removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for 4.4.1.
#11
follow-up:
↓ 12
@
9 years ago
- Resolution set to fixed
- Status changed from reopened to closed
In 36006:
#12
in reply to:
↑ 11
@
9 years ago
Thanks @boonebgorges, I see the version 4.4.1-alpha-36006 has the code fixed!
Related: #12981