Make WordPress Core

Changeset 50999


Ignore:
Timestamp:
05/25/2021 12:25:14 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Comments: Include a "View Post" link on the Comments screen for a single post.

This makes it easier to view the post on the front end of the site when moderating comments, without having to open the editor first.

Props trejder, audrasjb, vladytimy, lukecarbis, ayeshrajans, chaion07, paaljoachim, hareesh-pillai, SergeyBiryukov.
Fixes #52353.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-comments.php

    r49944 r50999  
    229229
    230230<?php
     231if ( $post_id ) {
     232    $post_type_object = get_post_type_object( get_post_type( $post_id ) );
     233
     234    if ( $post_type_object ) {
     235        printf(
     236            '<a href="%1$s" class="comments-view-item-link">%2$s</a>',
     237            get_permalink( $post_id ),
     238            $post_type_object->labels->view_item
     239        );
     240    }
     241}
     242
    231243if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    232244    echo '<span class="subtitle">';
Note: See TracChangeset for help on using the changeset viewer.