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.

git-svn-id: https://develop.svn.wordpress.org/trunk@50999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-05-25 12:25:14 +00:00
parent 645813bc57
commit 55572ad664

View File

@ -228,6 +228,18 @@ if ( $post_id ) {
</h1>
<?php
if ( $post_id ) {
$post_type_object = get_post_type_object( get_post_type( $post_id ) );
if ( $post_type_object ) {
printf(
'<a href="%1$s" class="comments-view-item-link">%2$s</a>',
get_permalink( $post_id ),
$post_type_object->labels->view_item
);
}
}
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
echo '<span class="subtitle">';
printf(