| 1 | diff --git a/src/wp-admin/comment.php b/src/wp-admin/comment.php |
|---|
| 2 | index c2eca11..287a215 100644 |
|---|
| 3 | --- a/src/wp-admin/comment.php |
|---|
| 4 | +++ b/src/wp-admin/comment.php |
|---|
| 5 | @@ -33,6 +33,12 @@ if ( isset( $_GET['dt'] ) ) { |
|---|
| 6 | $action = 'trash'; |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | +/** Stop operation if the post associated with the comment is trashed. */ |
|---|
| 10 | +$comment_id = absint( $_GET['c'] ); |
|---|
| 11 | +$comment = get_comment( $comment_id ); |
|---|
| 12 | +if ( 'trash' === get_post_status( $comment->comment_post_ID ) ) |
|---|
| 13 | + wp_die( __( 'You can’t operate on this comment because the associated post is in the Trash. Please restore the post first, then try again.' ) ); |
|---|
| 14 | + |
|---|
| 15 | switch( $action ) { |
|---|
| 16 | |
|---|
| 17 | case 'editcomment' : |
|---|
| 18 | diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php |
|---|
| 19 | index bf642ac..438b204 100644 |
|---|
| 20 | --- a/src/wp-admin/includes/class-wp-list-table.php |
|---|
| 21 | +++ b/src/wp-admin/includes/class-wp-list-table.php |
|---|
| 22 | @@ -659,6 +659,12 @@ class WP_List_Table { |
|---|
| 23 | printf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>', |
|---|
| 24 | __( 'No comments' ) |
|---|
| 25 | ); |
|---|
| 26 | + // Approved comments AND Posts that were trashed. Hyperlinks for editing are removed. |
|---|
| 27 | + } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) { |
|---|
| 28 | + printf( '<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>', |
|---|
| 29 | + $approved_comments_number, |
|---|
| 30 | + $pending_comments ? $approved_phrase : $approved_only_phrase |
|---|
| 31 | + ); |
|---|
| 32 | // Approved comments have different display depending on some conditions. |
|---|
| 33 | } elseif ( $approved_comments ) { |
|---|
| 34 | printf( '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', |
|---|