[wp-trac] [WordPress Trac] #47719: Consistency issue with `include` parameter set to "0" in `WP_Term_Query`

WordPress Trac noreply at wordpress.org
Wed Oct 22 16:28:51 UTC 2025


#47719: Consistency issue with `include` parameter set to "0" in `WP_Term_Query`
-------------------------------------------------+-------------------------
 Reporter:  audrasjb                             |       Owner:
                                                 |  johnjamesjacoby
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.9
Component:  Query                                |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback 2nd-opinion                           |
-------------------------------------------------+-------------------------
Changes (by johnjamesjacoby):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61048" 61048]:
 {{{
 #!CommitTicketReference repository="" revision="61048"
 Query: Prevent querying for all terms in `WP_Term_Query` when `include` is
 set to `[0]`.

 This change brings the `include` parameter of `WP_Term_Query` up-to-speed
 with the `include` and `__in` parameters of other `_Query` classes, so
 that sending a value of `[0]` will not unintentionally perform an unbound
 query that returns all Terms.

 It also introduces 3 new unit tests (for the Post, Term, and User query
 classes) to compare this behavior between them and ensure they remain
 consistent going forward.

 Props audrasjb, hareesh-pillai, hellofromTonya, johnjamesjacoby, mukesh27.

 Fixes #47719.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47719#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list