[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 13:13:55 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 rcorrales):
Thanks for implementing these changes and running all the tests!
> In my tests with a table with +14M records, query time went from 8
minutes to 11 seconds, generating the same results.
I'd like to add that, as noted in the ticket description, I also verified
the performance and results of the `UNION ALL` query using the `query`
filter with millions of records at that time (and there should be at least
a couple of large production sites running that workaround for a while as
well).
I agree that a new filter is no longer required, since the root cause is
being addressed, and further adjustments can still be made using other
filters if needed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61097#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list