[wp-trac] [WordPress Trac] #21879: wp_count_posts() cache is not destroyed after post inserts and deletions
WordPress Trac
wp-trac at lists.automattic.com
Thu Sep 13 01:23:39 UTC 2012
#21879: wp_count_posts() cache is not destroyed after post inserts and deletions
-------------------------------------+--------------------------
Reporter: mark8barnes | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Cache
Version: 3.4.2 | Severity: normal
Keywords: has-patch needs-testing |
-------------------------------------+--------------------------
`wp_count_posts()` caches its results, but that cache is not destroyed
when posts are inserted, deleted, or transitioned. This can lead to
incorrect counts.
The attached patch fixes that (although it doesn't destroy the cache set
when `$perm='readable'` in `wp_count_posts()`, which would be more complex
as we wouldn't know the name of the key(s), though it could be done with
`preg_match`).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21879>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list