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
This commit is contained in:
parent
f6138dc287
commit
635a1249f5
@ -57,9 +57,10 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||||||
$post_type_object = get_post_type_object( $post_type );
|
$post_type_object = get_post_type_object( $post_type );
|
||||||
|
|
||||||
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
|
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( "
|
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
|
||||||
SELECT COUNT( 1 ) FROM $wpdb->posts
|
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
|
AND post_author = %d
|
||||||
", $post_type, get_current_user_id() ) );
|
", $post_type, get_current_user_id() ) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user