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

WordPress Trac noreply at wordpress.org
Thu Jan 25 23:52:00 UTC 2024


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

Comment (by spacedmonkey):

 @peterwilsoncc The duplicate query comes from this
 [https://github.com/WordPress/wordpress-
 develop/blob/fe1df4023c8344dd4bb21035563e58ddd1731949/src/wp-includes
 /class-wp-query.php#L3499-L3511 lines]. In these contexts, $post_type is
 empty, when it should be a valid post type string. Changing the $post_type
 variable also effects this [https://github.com/WordPress/wordpress-
 develop/blob/fe1df4023c8344dd4bb21035563e58ddd1731949/src/wp-includes
 /class-wp-query.php#L3545 line]. Passing post type in `update_post_caches`
 when before it wasn't might be a problem in some edge cases, like if you
 filter $this->posts to have mixed post types.

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


More information about the wp-trac mailing list