Ticket #53948: 53948-admin-bar.php.diff
File 53948-admin-bar.php.diff, 2.3 KB (added by , 3 years ago) |
---|
-
src/wp-includes/admin-bar.php
696 696 * 697 697 * @since 3.1.0 698 698 * @since 5.5.0 Added a "View Post" link on Comments screen for a single post. 699 * @since 5.9.0 Added a placeholder for block editor to update "View Post" link when publishing post. 699 700 * 700 701 * @global WP_Term $tag 701 702 * @global WP_Query $wp_the_query WordPress Query object. … … 725 726 } 726 727 727 728 if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base ) 728 && 'add' !== $current_screen->action729 729 && ( $post_type_object ) 730 730 && current_user_can( 'read_post', $post->ID ) 731 731 && ( $post_type_object->public ) 732 732 && ( $post_type_object->show_in_admin_bar ) ) { 733 if ( 'draft' === $post->post_status ) { 733 734 if ( 'add' === $current_screen->action && use_block_editor_for_post( $post ) ) { 735 // Add a hidden placeholder when creating a new post with the block editor. 734 736 $preview_link = get_preview_post_link( $post ); 735 737 $wp_admin_bar->add_node( 736 738 array( 737 'id' => ' preview',739 'id' => 'view', 738 740 'title' => $post_type_object->labels->view_item, 739 741 'href' => esc_url( $preview_link ), 740 'meta' => array( ' target' => 'wp-preview-' . $post->ID),742 'meta' => array( 'class' => 'hidden' ), 741 743 ) 742 744 ); 743 } else { 744 $wp_admin_bar->add_node( 745 array( 746 'id' => 'view', 747 'title' => $post_type_object->labels->view_item, 748 'href' => get_permalink( $post->ID ), 749 ) 750 ); 745 } elseif ( 'add' !== $current_screen->action ) { 746 if ( 'draft' === $post->post_status ) { 747 $preview_link = get_preview_post_link( $post ); 748 $wp_admin_bar->add_node( 749 array( 750 'id' => 'preview', 751 'title' => $post_type_object->labels->view_item, 752 'href' => esc_url( $preview_link ), 753 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), 754 ) 755 ); 756 } else { 757 $wp_admin_bar->add_node( 758 array( 759 'id' => 'view', 760 'title' => $post_type_object->labels->view_item, 761 'href' => get_permalink( $post->ID ), 762 ) 763 ); 764 } 751 765 } 752 766 } elseif ( 'edit' === $current_screen->base 753 767 && ( $post_type_object )