| 1 | *** Begin Patch |
|---|
| 2 | *** Update File: wp-includes/admin-bar.php |
|---|
| 3 | @@ |
|---|
| 4 | function wp_admin_bar_view_site_menu( $wp_admin_bar ) { |
|---|
| 5 | global $post; |
|---|
| 6 | |
|---|
| 7 | if ( is_admin() ) { |
|---|
| 8 | $post_id = 0; |
|---|
| 9 | if ( isset( $_GET['post'] ) ) { |
|---|
| 10 | $post_id = (int) $_GET['post']; |
|---|
| 11 | } elseif ( isset( $_POST['post_ID'] ) ) { |
|---|
| 12 | $post_id = (int) $_POST['post_ID']; |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | if ( $post_id ) { |
|---|
| 16 | $post = get_post( $post_id ); |
|---|
| 17 | - if ( $post ) { |
|---|
| 18 | + // Hide "View" link for wp_block (synced patterns) since they are not publicly viewable. |
|---|
| 19 | + if ( $post && 'wp_block' !== $post->post_type ) { |
|---|
| 20 | $title = sprintf( __( 'View %s' ), wp_strip_all_tags( get_the_title( $post ) ) ); |
|---|
| 21 | $wp_admin_bar->add_node( |
|---|
| 22 | array( |
|---|
| 23 | 'id' => 'view', |
|---|
| 24 | 'title' => $title, |
|---|
| 25 | 'href' => get_permalink( $post ), |
|---|
| 26 | ) |
|---|
| 27 | ); |
|---|
| 28 | } |
|---|
| 29 | *** End Patch |
|---|