Opened 5 years ago
Last modified 5 years ago
#44279 new defect (bug)
`get_terms()` with `child_of` and `childless` combined
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.9.6 |
Component: | Taxonomy | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
Hi there! I'm not sure if I found a bug or this is intended behaviour: If I use a combination of childless
and child_of
in a get_terms
call, I get zero results.
My taxonomy's structure:
- Genre -- Hip Hop -- Trap -- Rap - Location -- Europe --- Germany --- Sweden --- Austria -- Asia --- China --- Japan --- Taiwan
My code:
<?php $location_parent = get_term(123, 'my_custom_taxonomy'); $countries = get_terms(array( 'taxonomy' => $location_parent->taxonomy, 'hide_empty' => false, 'child_of' => $location_parent->term_id, 'childless' => true ));
I'm trying to only list countries, basically children of 'location' that don't have children of their own.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
Hi @nonverbla - Thanks for the ticket. I'm unable to reproduce the problem with a unit test - see 44279.test.diff, which is passing. Can you have a look at that test to see if I've accurately captured what you're describing?