[wp-trac] [WordPress Trac] #61621: WP_Query get_posts should be call its property not again execute all caculations

WordPress Trac noreply at wordpress.org
Wed Jul 10 15:29:00 UTC 2024


#61621: WP_Query get_posts should be call its property not again execute all
caculations
--------------------------+-----------------------------
 Reporter:  pexlechris    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,
 I found out that there is a bug in core.
 In class WP_Query the get_posts method, executes again all the
 calculations... It should to call the posts property if exist and then if
 not exist to executes all the calculations.
 So when in my custom (or custom theme) code create an WP_Query instance
 and call the $WP_Query->get_posts(), the posts property is defined once in
 the constructor of the class and then again in the method get_posts.
 I found out that this is a problem when my WP_Query has a Tax_Query and it
 does multiple joins with the same table!!! Again and again...

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


More information about the wp-trac mailing list