[wp-trac] [WordPress Trac] #29839: Enhance get_terms to return only bottom child terms (terms without children) when taxonomy is heirarchical
WordPress Trac
noreply at wordpress.org
Sun Nov 23 17:45:10 UTC 2014
#29839: Enhance get_terms to return only bottom child terms (terms without
children) when taxonomy is heirarchical
---------------------------------+-----------------------------
Reporter: theMikeD | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version: 4.0
Severity: normal | Resolution:
Keywords: 4.2-early has-patch | Focuses:
---------------------------------+-----------------------------
Comment (by theMikeD):
>I guess 'child' would take an integer and return an array with a maximum
of one member, which would be the direct parent (since 'parent' returns
only direct descendants ...
You can get this already: use `get_term( $id, $tax, OBJECT )` and then
check the `parent` parameter.
> ... though tbh I find this naming convention to be pretty confusing).
I do as well. IMHO `parent` is doing two different things ( returning all
parent items, or returning children of a supplied term ) and should have
been written as two options. I don't think repeating that decision here is
a good idea, regardless of how my original summary is phrased and
especially because that functionality already exists in `get_term()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29839#comment:55>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list