#56721 closed defect (bug) (fixed)
get_page_by_title: duplicate SQL query
Reported by: | david.binda | Owned by: | peterwilsoncc |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 6.1 |
Component: | Posts, Post Types | Keywords: | has-patch commit |
Focuses: | performance | Cc: |
Description
The r54234 has introduced a duplicate SQL query triggered for the get_page_by_title
function, as it's executing the SQL query by passing the arguments for a WP_Query directly to the constructor of the class, and then triggering the WP_Query::get_posts()
directly, instead of accessing the WP_Query::posts
property.
See https://core.trac.wordpress.org/browser/trunk/src/wp-includes/post.php?rev=54320#L5790
Attachments (1)
Change History (12)
#3
@
2 years ago
- Keywords commit added
@spacedmonkey thanks for the confirmation.
56721.diff LGTM.
commit
added.
This ticket was mentioned in PR #3400 on WordPress/wordpress-develop by peterwilsoncc.
2 years ago
#5
- Keywords has-unit-tests added
#6
@
2 years ago
- Keywords has-unit-tests removed
- Owner set to peterwilsoncc
- Status changed from new to assigned
Thanks for the patch @davidbinda.
I've added a test in the linked pull request and will commit once the checks start passing.
peterwilsoncc commented on PR #3400:
2 years ago
#8
Committed in https://core.trac.wordpress.org/changeset/54377 / 4a9ab59d91f463d7b9021183d0702723fad91c87
Thanks @davidbinda. good cache.
r54234 is merge before some days in 6.1 milestone. Let's move to 6.1 for consideration. feel free to update milestone.
cc. @spacedmonkey @SergeyBiryukov