From 6d379c6f0ff45905c9bfed57808ebb014f1bc84e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 2 Feb 2018 07:37:10 +0000 Subject: [PATCH] Posts, Post Types: Don't count pending comments in `WP_Posts_List_Table::_display_rows()` if the post type does not support comments. Props seanchayes. Fixes #43212. git-svn-id: https://develop.svn.wordpress.org/trunk@42638 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-posts-list-table.php | 6 +++++- 1 file changed, 5 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 f642efad1c..18eccc78c0 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -656,6 +656,8 @@ if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->p * @param int $level */ private function _display_rows( $posts, $level = 0 ) { + $post_type = $this->screen->post_type; + // Create array of post IDs. $post_ids = array(); @@ -663,7 +665,9 @@ if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->p $post_ids[] = $a_post->ID; } - $this->comment_pending_count = get_pending_comments_num( $post_ids ); + if ( post_type_supports( $post_type, 'comments' ) ) { + $this->comment_pending_count = get_pending_comments_num( $post_ids ); + } foreach ( $posts as $post ) { $this->single_row( $post, $level );