Peter Wilson e6fa3b914c Query: Ensure secondary loops populate the full global post.
Modifies `WP_Query::the_post()` to ensure the entire global post object is populated regardless of the `fields` parameter initially set by the developer.

In secondary loops, this ensures that `get_the_content()` and other getter functions operate as documented when called without a post ID and return the appropriate data for the global post object.

This introduces consistency when starting the loop and the `fields` parameter is set to `id=>parent` to the behaviour when set to either `all` or `ids`.

There is no change to the `WP_Query::$posts` parameter nor when a query is made without starting the secondary loop, ie without calling `WP_Query::the_post()`.

Props juzar, mukesh27, oglekler, peterwilsoncc, sirlouen, joemcgill.
Fixes #56992.



git-svn-id: https://develop.svn.wordpress.org/trunk@59919 602fd350-edb4-49c9-b593-d223f7449a82
2025-03-03 21:43:44 +00:00
..