[wp-trac] [WordPress Trac] #41796: WP_Term_Query problem using object_ids and number attributes

WordPress Trac noreply at wordpress.org
Mon Sep 4 21:43:47 UTC 2017


#41796: WP_Term_Query problem using object_ids and number attributes
--------------------------+-----------------------------
 Reporter:  elvishp2006   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  4.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi, how are you? hope so :)
 I'm having a problem with the query generated by the WP_Term_Query class
 when using the "object_ids" and "number" attribute.

 When the same term is associated in more than 1 post, the generated
 "request" repeats this term for each occurrence in "object_ids", so if I
 pass the "number" attribute with the value 8, it may happen that a number
 of terms lower than expected.

 My suggestion is that when you have the "object_ids" attribute, force the
 distinct clause in the query.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41796>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list