[wp-trac] [WordPress Trac] #49685: Cached wp_count_posts() result may not contain all statuses
WordPress Trac
noreply at wordpress.org
Mon Mar 23 22:48:03 UTC 2020
#49685: Cached wp_count_posts() result may not contain all statuses
-------------------------------+------------------------------
Reporter: obliviousharmony | Owner: obliviousharmony
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 5.4
Severity: minor | Keywords:
Focuses: |
-------------------------------+------------------------------
Hello,
The `wp_count_posts()` function returns all of the post counts keyed by
the status. This result is cached and served on subsequent calls. If a
post status has no posts and has not been registered when the function is
called, the cached response will contain no entry for the status. This
leads to problems when iterating using `get_post_stati()` as not all of
the post statuses will have a count.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49685>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list