[wp-trac] [WordPress Trac] #61097: Filter `wp_count_posts()` query before execution to avoid slow query

WordPress Trac noreply at wordpress.org
Sun Sep 21 12:50:29 UTC 2025


#61097: Filter `wp_count_posts()` query before execution to avoid slow query
-------------------------------------------------+-------------------------
 Reporter:  rcorrales                            |       Owner:
                                                 |  westonruter
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.9
Component:  Posts, Post Types                    |     Version:  2.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:
  info commit has-dev-note add-to-field-guide    |  performance
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch has-unit-tests has-test-info commit =>
     has-patch has-unit-tests has-test-info commit has-dev-note add-to-
     field-guide


Comment:

 Replying to [comment:25 westonruter]:
 > @SirLouen Naturally the performance tests speak for themselves, but I
 wanted to get an AI second opinion and sanity check on the query changes
 since I don't have much experience with `UNION ALL` as I recall.

 I've added the
 [https://github.com/orgs/WordPress/projects/262?pane=issue&itemId=129933167
 corresponding `dev-note`] to comment about this enhancement.

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


More information about the wp-trac mailing list