[wp-trac] [WordPress Trac] #56992: The Loop displays incorrect data for queries started with `fields => 'id=>parent'`.

WordPress Trac noreply at wordpress.org
Sun Mar 16 00:38:50 UTC 2025


#56992: The Loop displays incorrect data for queries started with `fields =>
'id=>parent'`.
--------------------------------------+----------------------------
 Reporter:  peterwilsoncc             |       Owner:  peterwilsoncc
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.8
Component:  Query                     |     Version:  3.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+----------------------------

Comment (by SirLouen):

 Replying to [comment:48 peterwilsoncc]:
 > I don't think there is any benefit of adding a new parameter to bypass
 the bug fix as the partial data remains available via the posts property.
 The change in this PR makes the loop consistent with how it now works with
 `id` and `all`.

 If you check your [https://core.trac.wordpress.org/ticket/56992#comment:44
 comment 44] or my [https://core.trac.wordpress.org/ticket/56992#comment:45
 comment 45], in all the performance results, `all` is outperforming both
 `ids` and `id=>parent` and I can't be indifferent to this.

 On the paper, everything looks right. But in my mind, both `ids` and
 `id=>parent` should have been the outperforming options (because of their
 optimal nature) but it's not the case, doing one obvious extra query each
 one.

 For example, back in the day:
 https://core.trac.wordpress.org/ticket/56948#comment:6
 People still think that `ids` is the performing option

 And also its interesting to see that you play around the idea of
 `id=>parent` back in the day
 https://core.trac.wordpress.org/ticket/56948#comment:12
 But it did not progress (By reading it, I'm wondering why)

 So my question is: Why not simply, and always, querying the entire posts
 if you we are ultimately planning to call `the_post`?

 Maybe a `_doing_it_wrong` could have been interesting in this case?

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


More information about the wp-trac mailing list