[wp-trac] [WordPress Trac] #36949: Term exists should use get_terms internally
WordPress Trac
noreply at wordpress.org
Thu Mar 17 14:04:41 UTC 2022
#36949: Term exists should use get_terms internally
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| spacedmonkey
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.0
Component: Taxonomy | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note needs-testing commit | performance
-------------------------------------------------+-------------------------
Changes (by Chouby):
* status: closed => reopened
* resolution: fixed =>
Comment:
May I ask to introduce a new filter `term_exists_args`?
Indeed each time `get_terms()` replaces a direct sql query, it introduces
a breaking change. `get_terms()` is widely used and can be filtered with
`terms_clauses`. The issue is that this filter will now be applied to
`term_exists()` when it was not applied prior to [52921]. Currently there
is no way to determine if the call to `get_terms()` is done by
`term_exists()` or not, so we cannot disable the filter accordingly.
Unless using an ugly hack with `debug_backtrace()`...
A new filter `term_exists_args` would allow to work around the breaking
chanege in an elegant way.
Related:
- [40994] introduced the filter `wp_get_object_term_args` after
`wp_get_object_terms()` switched to use `get_terms()` since [38667].
- #42104 Same issue for `transform_query()`
- #54534 Same issue for `get_terms_by()`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36949#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list