[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 02:22:54 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 peterwilsoncc):

 @SirLouen You've asked for a second opinion, received a second opinion and
 continue to prosecute this. I understand your argument but both Joe and I
 are in agreement that if a user starts the loop, the loop should work as
 intended.

 #56948 made that happen for IDs, and this issue was logged to make that
 happen for `id, parent`.

 Calling `WP_Query` with a request for partial fields WILL result in a
 performance issue if you subsequently start the loop. That's the fix. **No
 one is recommending that developers set up the loop without `all` fields,
 but we have decided that we need to accommodate the situation.**

 ----


 What I am happy to continue working on and discussing is this: the
 original commit impacted `fields => all` when starting the loop and this
 ought to be avoided. There is a work in progress PR for this fix, and once
 I'm happy it's working as intended I'll mark it ready for review and get
 in touch with some other committers to review it.

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


More information about the wp-trac mailing list