[wp-trac] [WordPress Trac] #53280: Incorrect use of WP_Query::get_posts in new get_block_template and get_block_templates functions
WordPress Trac
noreply at wordpress.org
Mon Jun 14 20:38:52 UTC 2021
#53280: Incorrect use of WP_Query::get_posts in new get_block_template and
get_block_templates functions
--------------------------+--------------------------
Reporter: david.binda | Owner: jorbin
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.8
Component: Widgets | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
--------------------------+--------------------------
Changes (by jorbin):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"51144" 51144]:
{{{
#!CommitTicketReference repository="" revision="51144"
Block Editor: Prevent duplicate queries
When passing args to `WP_Query::__construct` method (in this case, but
creating a `new WP_Query`, this one internally executes the
`WP_Query::get_posts` method and stores the result in the
`WP_Query::posts` property. When calling the `WP_Query::get_posts` again,
the same SQL query gets executed, and the result is again stored in the
`WP_Query::posts` property.
This was introduced in [51003].
Props david.binda, jorbin.
Fixes #53280. See #53176.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53280#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list