[wp-trac] [WordPress Trac] #59442: Duplicate query in WP_Query

WordPress Trac noreply at wordpress.org
Mon Sep 25 11:32:47 UTC 2023


#59442: Duplicate query in WP_Query
--------------------------+-----------------------------
 Reporter:  spacedmonkey  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  6.2
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+-----------------------------
 When a site using a classic theme and has sticky posts, that can result in
 duplicate query. ( See attached screenshot ). This is because post_type
 variable passed the sticky sub query, is empty string on the first run.
 See the [https://github.com/WordPress/wordpress-
 develop/blob/de9e06a4c021295af3ac11fdd08ea29a57529668/src/wp-includes
 /class-wp-query.php#L3493 line]. This results in different cache query key
 being generating, resulting in duplicate queries.

 Steps to replicate.

 1. Set theme to 2016.
 2. Import theme data test data.
 3. Go to home page.
 4. Open query monitor, see duplicate query.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59442>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list