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
This commit is contained in:
Sergey Biryukov 2018-02-02 07:37:10 +00:00
parent 6073df2b45
commit 6d379c6f0f
1 changed files with 5 additions and 1 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 );