function wp_count_posts( $type = 'post',
$perm = ''
) { global $wpdb;
if ( !
post_type_exists( $type ) ) { return new stdClass();
} $cache_key =
_count_posts_cache_key( $type,
$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 */