diff --git a/wp-includes/post.php b/wp-includes/post.php index 097f8186e9..20c4d4da42 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2647,6 +2647,13 @@ function wp_count_posts( $type = 'post', $perm = '' ) { $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { + // We may have cached this before every status was registered. + foreach ( get_post_stati() as $status ) { + if ( ! isset( $counts->{$status} ) ) { + $counts->{$status} = 0; + } + } + /** This filter is documented in wp-includes/post.php */ return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index df9ef47882..416fa8f053 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta2-48496'; +$wp_version = '5.5-beta2-48497'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.