Ticket #53948: 53948.2.diff
File 53948.2.diff, 2.3 KB (added by , 2 years ago) |
---|
-
src/wp-includes/admin-bar.php
728 728 * 729 729 * @since 3.1.0 730 730 * @since 5.5.0 Added a "View Post" link on Comments screen for a single post. 731 * @since 6.0.0 Added a placeholder for block editor to update "View Post" link when publishing post. 731 732 * 732 733 * @global WP_Term $tag 733 734 * @global WP_Query $wp_the_query WordPress Query object. … … 757 758 } 758 759 759 760 if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base ) 760 && 'add' !== $current_screen->action761 761 && ( $post_type_object ) 762 762 && current_user_can( 'read_post', $post->ID ) 763 763 && ( $post_type_object->public ) 764 764 && ( $post_type_object->show_in_admin_bar ) ) { 765 if ( 'draft' === $post->post_status ) { 765 766 if ( 'add' === $current_screen->action && use_block_editor_for_post( $post ) ) { 767 // Add a hidden placeholder when creating a new post with the block editor. 766 768 $preview_link = get_preview_post_link( $post ); 767 769 $wp_admin_bar->add_node( 768 770 array( 769 'id' => ' preview',771 'id' => 'view', 770 772 'title' => $post_type_object->labels->view_item, 771 773 'href' => esc_url( $preview_link ), 772 'meta' => array( ' target' => 'wp-preview-' . $post->ID),774 'meta' => array( 'class' => 'hidden' ), 773 775 ) 774 776 ); 775 } else { 776 $wp_admin_bar->add_node( 777 array( 778 'id' => 'view', 779 'title' => $post_type_object->labels->view_item, 780 'href' => get_permalink( $post->ID ), 781 ) 782 ); 777 } elseif ( 'add' !== $current_screen->action ) { 778 if ( 'draft' === $post->post_status ) { 779 $preview_link = get_preview_post_link( $post ); 780 $wp_admin_bar->add_node( 781 array( 782 'id' => 'preview', 783 'title' => $post_type_object->labels->view_item, 784 'href' => esc_url( $preview_link ), 785 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), 786 ) 787 ); 788 } else { 789 $wp_admin_bar->add_node( 790 array( 791 'id' => 'view', 792 'title' => $post_type_object->labels->view_item, 793 'href' => get_permalink( $post->ID ), 794 ) 795 ); 796 } 783 797 } 784 798 } elseif ( 'edit' === $current_screen->base 785 799 && ( $post_type_object )