Don't display Edit links for posts and terms in toolbar if they are empty.
props boonebgorges. fixes #29538. Built from https://develop.svn.wordpress.org/trunk@29714 git-svn-id: http://core.svn.wordpress.org/trunk@29488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
971b84e577
commit
cc04e76d11
|
@ -530,22 +530,24 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
|||
if ( ! empty( $current_object->post_type )
|
||||
&& ( $post_type_object = get_post_type_object( $current_object->post_type ) )
|
||||
&& current_user_can( 'edit_post', $current_object->ID )
|
||||
&& $post_type_object->show_ui && $post_type_object->show_in_admin_bar )
|
||||
&& $post_type_object->show_ui && $post_type_object->show_in_admin_bar
|
||||
&& $edit_post_link = get_edit_post_link( $current_object->ID ) )
|
||||
{
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'id' => 'edit',
|
||||
'title' => $post_type_object->labels->edit_item,
|
||||
'href' => get_edit_post_link( $current_object->ID )
|
||||
'href' => $edit_post_link
|
||||
) );
|
||||
} elseif ( ! empty( $current_object->taxonomy )
|
||||
&& ( $tax = get_taxonomy( $current_object->taxonomy ) )
|
||||
&& current_user_can( $tax->cap->edit_terms )
|
||||
&& $tax->show_ui )
|
||||
&& $tax->show_ui
|
||||
&& $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) )
|
||||
{
|
||||
$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 )
|
||||
'href' => $edit_term_link
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue