[wp-trac] [WordPress Trac] #47314: Add "parent" parameter to get_term_by
WordPress Trac
noreply at wordpress.org
Fri May 17 22:13:02 UTC 2019
#47314: Add "parent" parameter to get_term_by
-----------------------------+-----------------------------
Reporter: leogermani | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
There has been some discussion around some inconsistencies in the way
`term_exists()` handles the input string and sometimes can have
unexpeceted results. The most recent discussions about this can be seen in
#47099, #45333 and #32248.
The current recommendation is to use `get_term_by()` instead, so you can
explicitly inform what field you are checking and get the right result.
However, `get_term_by()` does not support a `parent` argument, which makes
it not a full `term_exists()` replacement.
In #47099 @boonebgorges suggested we opened an enhancement ticket to
discuss this addition to this function. And here it is! :)
Looking at the function and all parameters it gets, we would have to
decide how to support this.
This would be the first question to ask if one was to try an approach for
this. Adding as a new parameter does not look so good because there
already many and it would force the developer to use all of them if he/she
wanted to use `parent`. However adding support for a field like
`name_and_parent` or something like this, and having an array passed as
the `$value` doesn't look so pretty either.
What do you think?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47314>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list