[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:44:57 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):
> Personally I think returning all terms would lead to confusing results
for users who accidentally run this option on a non-hierarchical taxonomy.
Imagine a hierarchical taxonomy with 27 terms: A-Z (all top-level) and
A_child (child of A). `get_terms()` with `childless=true` would return B-Z
+ A_child. Now imagine you deleted A_child. Expected behavior, IMO, would
be to return A-Z, but on your suggestion it'd return nothing. I'm not too
concerned with what happens to people using this argument on a non-
hierarchical taxonomy, but even in that case, returning all items would be
the semantically correct thing to do.
> I may even be able to remove the check altogether, but I'd have to test
that first. The unit test would be to create a flat taxonomy and compare
all with childless so it's easy enough to confirm.
Yes, I think we should do this.
Boolean typecast looks good.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29839#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list