WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/02/2018 07:37:10 AM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r42343 r42638  
    657657     */
    658658    private function _display_rows( $posts, $level = 0 ) {
     659        $post_type = $this->screen->post_type;
     660
    659661        // Create array of post IDs.
    660662        $post_ids = array();
     
    664666        }
    665667
    666         $this->comment_pending_count = get_pending_comments_num( $post_ids );
     668        if ( post_type_supports( $post_type, 'comments' ) ) {
     669            $this->comment_pending_count = get_pending_comments_num( $post_ids );
     670        }
    667671
    668672        foreach ( $posts as $post ) {
Note: See TracChangeset for help on using the changeset viewer.