diff --git src/wp-admin/includes/class-wp-comments-list-table.php src/wp-admin/includes/class-wp-comments-list-table.php
index a11eefc873..206e1b6823 100644
|
|
class WP_Comments_List_Table extends WP_List_Table { |
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
| 541 | * @since 5.4.0 Do not display comments for post types that are no longer registered. |
| 542 | * |
541 | 543 | * @global WP_Post $post Global post object. |
542 | 544 | * @global WP_Comment $comment Global comment object. |
543 | 545 | * |
… |
… |
class WP_Comments_List_Table extends WP_List_Table { |
557 | 559 | if ( $comment->comment_post_ID > 0 ) { |
558 | 560 | $post = get_post( $comment->comment_post_ID ); |
559 | 561 | } |
| 562 | |
| 563 | // Check if post type exists or not |
| 564 | $post_type_object = get_post_type_object( $post->post_type ); |
| 565 | |
| 566 | // Early exit, if the post type doesn't exists. |
| 567 | if ( null === $post_type_object ) { |
| 568 | return; |
| 569 | } |
| 570 | |
560 | 571 | $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); |
561 | 572 | |
562 | 573 | echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>"; |