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.
Built from https://develop.svn.wordpress.org/trunk@50999


git-svn-id: http://core.svn.wordpress.org/trunk@50608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-05-25 12:26:58 +00:00
parent c649d69a9a
commit 670ec9cfa7
2 changed files with 13 additions and 1 deletions

View File

@ -228,6 +228,18 @@ if ( $post_id ) {
</h1> </h1>
<?php <?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'] ) ) { if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
echo '<span class="subtitle">'; echo '<span class="subtitle">';
printf( printf(

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-alpha-50998'; $wp_version = '5.8-alpha-50999';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.