Toolbar: Display a "View Post" link when viewing comments for a single post on Comments screen.
Props Otto42, matt, SergeyBiryukov. Fixes #50312. Built from https://develop.svn.wordpress.org/trunk@47903 git-svn-id: http://core.svn.wordpress.org/trunk@47677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
27485fd7aa
commit
524f188982
|
@ -696,19 +696,25 @@ function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
|
|||
* @param WP_Admin_Bar $wp_admin_bar
|
||||
*/
|
||||
function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||
global $tag, $wp_the_query, $user_id;
|
||||
global $tag, $wp_the_query, $user_id, $post_id;
|
||||
|
||||
if ( is_admin() ) {
|
||||
$current_screen = get_current_screen();
|
||||
$post = get_post();
|
||||
$current_screen = get_current_screen();
|
||||
$post = get_post();
|
||||
$post_type_object = null;
|
||||
|
||||
if ( 'post' === $current_screen->base ) {
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
} elseif ( 'edit' === $current_screen->base ) {
|
||||
$post_type_object = get_post_type_object( $current_screen->post_type );
|
||||
} elseif ( 'edit-comments' === $current_screen->base && $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( $post ) {
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'post' === $current_screen->base
|
||||
if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base )
|
||||
&& 'add' !== $current_screen->action
|
||||
&& ( $post_type_object )
|
||||
&& current_user_can( 'read_post', $post->ID )
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47902';
|
||||
$wp_version = '5.5-alpha-47903';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue