WordPress.org

Make WordPress Core

Ticket #37826: 37826.3.patch

File 37826.3.patch, 1.8 KB (added by stevenlinx, 5 years ago)
  • src/wp-admin/comment.php

    diff --git a/src/wp-admin/comment.php b/src/wp-admin/comment.php
    index c2eca11..287a215 100644
    a b if ( isset( $_GET['dt'] ) ) { 
    3333                $action = 'trash';
    3434}
    3535
     36/** Stop operation if the post associated with the comment is trashed. */
     37$comment_id = absint( $_GET['c'] );
     38$comment = get_comment( $comment_id );
     39if ( 'trash' === get_post_status( $comment->comment_post_ID ) )
     40        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.' ) );
     41
    3642switch( $action ) {
    3743
    3844case 'editcomment' :
  • src/wp-admin/includes/class-wp-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
    index bf642ac..438b204 100644
    a b class WP_List_Table { 
    659659                        printf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
    660660                                __( 'No comments' )
    661661                        );
     662                // Approved comments AND Posts that were trashed. Hyperlinks for editing are removed.
     663                } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
     664                        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>',
     665                                $approved_comments_number,
     666                                $pending_comments ? $approved_phrase : $approved_only_phrase
     667                        );
    662668                // Approved comments have different display depending on some conditions.
    663669                } elseif ( $approved_comments ) {
    664670                        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>',