Post lists table: When counting a user's posts, use get_post_stati() instead of hardcoded internal statuses.
props creativeinfusion. fixes #24818. Built from https://develop.svn.wordpress.org/trunk@25676 git-svn-id: http://core.svn.wordpress.org/trunk@25592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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() ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user