Opened 13 years ago
Closed 13 years ago
#17273 closed defect (bug) (fixed)
Admin Bar Edit link should support Attachments
Reported by: | dd32 | Owned by: | dd32 |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently the Admin bar presents a Edit link for any post type for which the user can edit the post and, show_ui = true.
Attachments pass every check, except due to their inbuilt nature, show_ui is false.
-
wp-includes/admin-bar.php
165 165 if ( empty($current_object) ) 166 166 return; 167 167 168 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) {168 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 ) ) { 169 169 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link( $current_object->ID ) ) ); 170 170 } elseif ( ! empty( $current_object->taxonomy ) && ( $tax = get_taxonomy( $current_object->taxonomy ) ) && current_user_can( $tax->cap->edit_terms ) && $tax->show_ui ) { 171 171 $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 ) ) );
Can anyone see a better method other than the above patch?
Change History (2)
Note: See
TracTickets for help on using
tickets.
Looks good to me.