Make WordPress Core


Ignore:
Timestamp:
06/15/2020 11:04:27 PM (5 years ago)
Author:
whyisjake
Message:

Comments: Don't display edit links to trashed post comments.

If a post is in the trash, the comments bubble won't link to the comments list.

Fixes: #37826.
Props: swissspidy, helen, FolioVision, DrewAPicture, stevenlinx, donmhico, birgire, garrett-eclipse, andraganescu, johnbillion.

File:
1 edited

Legend:

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

    r47915 r48050  
    683683        );
    684684
    685         // No comments at all.
    686685        if ( ! $approved_comments && ! $pending_comments ) {
     686            // No comments at all.
    687687            printf(
    688688                '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
    689689                __( 'No comments' )
    690690            );
    691             // Approved comments have different display depending on some conditions.
     691        } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
     692            // Don't link the comment bubble for a trashed post.
     693            printf(
     694                '<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>',
     695                $approved_comments_number,
     696                $pending_comments ? $approved_phrase : $approved_only_phrase
     697            );
    692698        } elseif ( $approved_comments ) {
     699            // Link the comment bubble to approved comments.
    693700            printf(
    694701                '<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>',
     
    706713            );
    707714        } else {
     715            // Don't link the comment bubble when there are no approved comments.
    708716            printf(
    709717                '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
Note: See TracChangeset for help on using the changeset viewer.