#31105 closed enhancement (duplicate)
Abstract get_terms() arguments for use in wp_get_object_terms()
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | needs-patch |
Focuses: | Cc: |
Description
While get_terms()
and wp_get_object_terms()
have different use cases, there's a lot of overlap in terms of how one might want to filter results by the various properties of the matched terms. There's no reason why wp_get_object_terms()
shouldn't support many of the term-filtering arguments of get_terms()
: exclude, exclude_tree, include, name, slug, parent, child_of, namelike, descriptionlike, search, hierarchical, and perhaps others. See #18106, #15675, etc.
Obviously, reproducing all of the argument parsing and SQL generation of get_terms()
inside of wp_get_object_terms()
is not ideal. It'd be nice of some of this was abstracted out - into a helper class? I dunno - so that it could be shared by the two functions, and perhaps elsewhere.
Change History (3)
Note: See
TracTickets for help on using
tickets.
WP_Term_Query
should make this easier. [37572].