From 2f54a933695ffe75017fdbdc00ccebd5222ecb84 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 2 Feb 2018 07:38:32 +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. Built from https://develop.svn.wordpress.org/trunk@42638 git-svn-id: http://core.svn.wordpress.org/trunk@42467 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-posts-list-table.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index f642efad1c..18eccc78c0 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 868c7a90e7..cea83fab55 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42637'; +$wp_version = '5.0-alpha-42638'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.