[wp-trac] [WordPress Trac] #56992: The Loop displays incorrect data for queries started with `fields => 'id=>parent'`.
WordPress Trac
noreply at wordpress.org
Thu Feb 27 03:07:36 UTC 2025
#56992: The Loop displays incorrect data for queries started with `fields =>
'id=>parent'`.
-------------------------------------------------+-------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.8
Component: Query | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback 2nd-opinion |
-------------------------------------------------+-------------------------
Comment (by peterwilsoncc):
I've [https://github.com/WordPress/wordpress-develop/pull/8418 created an
alternative pull request] to address the concerns @SirLouen raises.
* the return value of `WP_Query::next_post()` is unchanged
* Incomplete data in the loop is addressed within `WP_Query::the_post()`
* Includes the follow up to [54771] that was assigned to be worked on for
this ticket
What changes:
* Secondary loops ensure the global post is fully populated, allowing
`get_the_title()`, `get_the_content(), `get_post()`, etc, etc to work as
documented when called without a parameter.
* The post and author cache is correctly primed when starting the loop for
`parent=>id` queries
I've written up unit tests for the changes and pushed them prior to the
source changes to demonstrate the issue I was seeing when in the loop.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56992#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list