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
This commit is contained in:
Sergey Biryukov 2018-02-02 07:38:32 +00:00
parent 66e2c1ed87
commit 2f54a93369
2 changed files with 6 additions and 2 deletions

View File

@ -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 );

View File

@ -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.