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

WordPress Trac noreply at wordpress.org
Sat Sep 20 05:08:17 UTC 2025


#61097: Filter `wp_count_posts()` query before execution to avoid slow query
-------------------------------------------------+-------------------------
 Reporter:  rcorrales                            |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.9
Component:  Posts, Post Types                    |     Version:  2.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:
  info                                           |  performance
-------------------------------------------------+-------------------------

Comment (by westonruter):

 The [https://github.com/WordPress/wordpress-develop/pull/9772 PR] looks
 good.

 I do have a question on whether the new filter is needed, however.
 Originally it was proposed as a way to fix the problem if the SQL query
 wasn't optimized. But the optimization with `UNION ALL` is applied. So is
 the filter still needed?

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


More information about the wp-trac mailing list