From 635a1249f59727a194cc56b6ca78e7ee514e6c07 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 3 Oct 2013 00:59:12 +0000 Subject: [PATCH] Post lists table: When counting a user's posts, use get_post_stati() instead of hardcoded internal statuses. props creativeinfusion. fixes #24818. git-svn-id: https://develop.svn.wordpress.org/trunk@25676 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-posts-list-table.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index c5b686ab4b..79afc47289 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -57,9 +57,10 @@ class WP_Posts_List_Table extends WP_List_Table { $post_type_object = get_post_type_object( $post_type ); if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { + $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) ); $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( " SELECT COUNT( 1 ) FROM $wpdb->posts - WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' ) + WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) AND post_author = %d ", $post_type, get_current_user_id() ) );