`get_terms()` with `child_of` and `childless` combined
I have a hierarchical taxonomy filter
that contains locations and genres for posts with the custom type artist
:
- Genre
-- Hip Hop
-- Trap
-- Rap
- Location
-- Europe
--- Germany
--- Sweden
--- Austria
-- Asia
--- China
--- Japan
--- Taiwan
Now I would like to use get_terms() to only get the Countries (children of 'Location' without children of their own). I thought this should work:
$location_parent = get_term(123, 'filter');
$countries = get_terms(array(
'taxonomy' = $location_parent-taxonomy,
'hide_empty' = false,
'child_of' = $location_parent-term_id,
'childless' = true
));
...but it somehow doesn't. child_of
and childless
seem to get in each other's way. Any ideas?