[wp-trac] [WordPress Trac] #55439: Introduce term_exists_args filter

WordPress Trac noreply at wordpress.org
Tue Mar 22 08:51:58 UTC 2022


#55439: Introduce term_exists_args filter
-------------------------+-----------------------------
 Reporter:  Chouby       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Taxonomy     |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 [52921], as each time `get_terms()` replaces a direct sql query,
 introduced a breaking changed.

 `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/55439>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list