Make WordPress Core

Changeset 29714

Timestamp:
09/07/2014 08:31:57 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Don't display Edit links for posts and terms in toolbar if they are empty.

props boonebgorges.
fixes #29538.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r29695 r29714  
    531531            && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
    532532            && current_user_can( 'edit_post', $current_object->ID )
    533             && $post_type_object->show_ui && $post_type_object->show_in_admin_bar )
     533            && $post_type_object->show_ui && $post_type_object->show_in_admin_bar
     534            && $edit_post_link = get_edit_post_link( $current_object->ID ) )
    534535        {
    535536            $wp_admin_bar->add_menu( array(
    536537                'id' => 'edit',
    537538                'title' => $post_type_object->labels->edit_item,
    538                 'href' => get_edit_post_link( $current_object->ID )
     539                'href' =>
    539540            ) );
    540541        } elseif ( ! empty( $current_object->taxonomy )
    541542            && ( $tax = get_taxonomy( $current_object->taxonomy ) )
    542543            && current_user_can( $tax->cap->edit_terms )
    543             && $tax->show_ui )
     544            && $tax->show_ui
     545            && $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) )
    544546        {
    545547            $wp_admin_bar->add_menu( array(
    546548                'id' => 'edit',
    547549                'title' => $tax->labels->edit_item,
    548                 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy )
     550                'href' =>
    549551            ) );
    550552        }
Note: See TracChangeset for help on using the changeset viewer.