[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 16 15:11:30 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
Component: Taxonomy | Release
Severity: normal | Version: 4.0
Keywords: 4.2-early good-first-bug has-patch | Resolution:
| Focuses:
------------------------------------------------+--------------------------
Comment (by boonebgorges):
> I bomb out for the same reason that parent does: there is no such thing
as a child term if there is no hierarchy. If I didn't then this option
would be the same as all which doesn't sit with me.
Hm. In cases where the hierarchy is flat, technically *all* nodes are leaf
nodes. So my inclination would be to return all items.
> Is that handled somewhere or is it safe to assume that !false or !0 is
true with the boolean options? I based this on $args['hierarchical'] which
also doesn't check this.
It's not handled anywhere that I can see. This code is quite old and not
necessarily up to standards, so don't use it as a model here. That being
said, I think it's OK to accept 0 as an option here - just cast to bool at
some point.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29839#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list