#31105 closed enhancement (duplicate)
Abstract get_terms() arguments for use in wp_get_object_terms()
| Reported by: | boonebgorges | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Taxonomy | Version: | |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
WP_Term_Queryshould make this easier. [37572].