diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index db8b031ab..f9b3d59b1 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -261,6 +261,7 @@ class WP_Terms_List_Table extends WP_List_Table { } if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) $actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . ""; + $actions['view'] = '' . __( 'View' ) . ''; $actions = apply_filters( 'tag_row_actions', $actions, $tag ); $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 7a80789c2..1375d2419 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -89,14 +89,24 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { /* Add the "My Account" sub menus */ $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) ); - if ( is_multisite() ) - $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); - else - $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) ); } } +/** + * Add the "Dashboard"/"View Site" menu. + * + * @since 3.2.0 + */ +function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { + if ( is_admin() ) + $wp_admin_bar->add_menu( array( 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); + elseif ( is_multisite() ) + $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( get_current_user_id() ) ) ); + else + $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); +} + /** * Add the "My Sites/[Site Name]" menu and all submenus. * @@ -160,15 +170,60 @@ function wp_admin_bar_shortlink_menu( $wp_admin_bar ) { * @since 3.1.0 */ function wp_admin_bar_edit_menu( $wp_admin_bar ) { - $current_object = get_queried_object(); + global $post, $tag; - if ( empty($current_object) ) - return; + if ( is_admin() ) { + $current_screen = get_current_screen(); - if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) ) { - $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link( $current_object->ID ) ) ); - } elseif ( ! empty( $current_object->taxonomy ) && ( $tax = get_taxonomy( $current_object->taxonomy ) ) && current_user_can( $tax->cap->edit_terms ) && $tax->show_ui ) { - $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) ) ); + if ( 'post' == $current_screen->base + && 'add' != $current_screen->action + && ( $post_type_object = get_post_type_object( $post->post_type ) ) + && current_user_can( $post_type_object->cap->read_post, $post->ID ) + && ( $post_type_object->public ) ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'view', + 'title' => $post_type_object->labels->view_item, + 'href' => get_permalink( $post->ID ) + ) ); + } elseif ( 'edit-tags' == $current_screen->base + && isset( $tag ) && is_object( $tag ) + && ( $tax = get_taxonomy( $tag->taxonomy ) ) + && $tax->public ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'view', + 'title' => $tax->labels->view_item, + 'href' => get_term_link( $tag ) + ) ); + } + } else { + $current_object = get_queried_object(); + + if ( empty($current_object) ) + return; + + if ( ! empty( $current_object->post_type ) + && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) + && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) + && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'edit', + 'title' => $post_type_object->labels->edit_item, + 'href' => get_edit_post_link( $current_object->ID ) + ) ); + } elseif ( ! empty( $current_object->taxonomy ) + && ( $tax = get_taxonomy( $current_object->taxonomy ) ) + && current_user_can( $tax->cap->edit_terms ) + && $tax->show_ui ) + { + $wp_admin_bar->add_menu( array( + 'id' => 'edit', + 'title' => $tax->labels->edit_item, + 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) + ) ); + } } } diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 549d5ecf2..8a8c8fced 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -180,6 +180,7 @@ class WP_Admin_Bar { function add_menus() { add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 15 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 ); add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 ); diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 2874891fe..9180b152b 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -404,6 +404,7 @@ function get_taxonomy_labels( $tax ) { 'parent_item' => array( null, __( 'Parent Category' ) ), 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), + 'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ), 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ), 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),