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

WordPress Trac noreply at wordpress.org
Sat May 4 20:58:16 UTC 2024


#59442: Duplicate query in WP_Query
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  pbearne
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.6
Component:  Query                                |     Version:  6.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback early         |     Focuses:
  changes-requested                              |  performance
-------------------------------------------------+-------------------------

Comment (by rodionov201):

 Hello, I'm encountering an issue related to WP_Query where having sticky
 posts on a site using a classic theme (like Twenty Sixteen) leads to
 duplicate queries. This seems to be due to the `post_type` variable being
 passed as an empty string in the sticky subquery during its first run,
 which then generates a different cache query key. I noticed there's a
 patch under discussion that revises how post types are handled to prevent
 this.

 Could you provide insights on how the proposed changes in the patch (e.g.,
 setting a default post type if none is defined) address the duplicate
 query issue? Also, are there any considerations or additional adjustments
 we should be aware of when implementing this patch to ensure it integrates
 smoothly without affecting backward compatibility?

 Thank you!

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


More information about the wp-trac mailing list