WordPress.org

Make WordPress Core

Ticket #24818: 24818.diff

File 24818.diff, 921 bytes (added by creativeinfusion, 6 years ago)

Add show_in_admin_all_list states into user counts query

  • wp-admin/includes/class-wp-posts-list-table.php

     
    5757                $post_type_object = get_post_type_object( $post_type );
    5858
    5959                if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
     60                if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
     61                        $exclude_states = get_post_stati( array('show_in_admin_all_list' => false) );
    6062                        $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
    6163                                SELECT COUNT( 1 ) FROM $wpdb->posts
    62                                 WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
     64                                WHERE post_type = %s AND post_status NOT IN ( '".implode("','", $exclude_states)."' )
    6365                                AND post_author = %d
    6466                        ", $post_type, get_current_user_id() ) );
    6567