mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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:
parent
3878927045
commit
71b350a317
@ -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>';
|
||||
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user