WordPress.org

Make WordPress Core

Ticket #34918: 34918.diff

File 34918.diff, 794 bytes (added by UmeshSingla, 3 years ago)

Hide the comments if associated post type isn't available

  • wp-admin/includes/class-wp-comments-list-table.php

     
    492492                if ( $comment->comment_post_ID > 0 ) {
    493493                        $post = get_post( $comment->comment_post_ID );
    494494                }
     495                //Check if post type exists or not
     496                $post_type_object = get_post_type_object( $post->post_type );
     497
     498                //Return, If the post type doesn't exists anymore
     499                if( !is_object( $post_type_object ) || null == $post_type_object ) {
     500                        return;
     501                }
     502
    495503                $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
    496504
    497505                echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";