Don't include internal post types in the total. see #9674

git-svn-id: http://svn.automattic.com/wordpress/trunk@13198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-18 20:01:10 +00:00
parent 3878927045
commit 71b350a317
2 changed files with 8 additions and 4 deletions

View File

@ -228,7 +228,12 @@ if ( $user_posts ) {
$allposts = '&all_posts=1';
}
$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
$total_posts = array_sum( (array) $num_posts );
// Subtract post types that are not included in the admin all list.
foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
$total_posts -= $num_posts->$state;
$class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : '';
$status_links[] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';

View File

@ -1425,10 +1425,9 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
$count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
$stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'trash' => 0 );
foreach( (array) $count as $row_num => $row ) {
$stats = array_fill_keys( get_post_stati(), 0);
foreach ( (array) $count as $row_num => $row )
$stats[$row['post_status']] = $row['num_posts'];
}
$stats = (object) $stats;
wp_cache_set($cache_key, $stats, 'counts');