Make WordPress Core

Ticket #33763: 33763.3.diff

File 33763.3.diff, 3.1 KB (added by johnbillion, 10 years ago)
  • src/wp-includes/admin-bar.php

     
    593593                if ( ! empty( $current_object->post_type )
    594594                        && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
    595595                        && current_user_can( 'edit_post', $current_object->ID )
    596                         && $post_type_object->show_ui && $post_type_object->show_in_admin_bar
     596                        && $post_type_object->show_in_admin_bar
    597597                        && $edit_post_link = get_edit_post_link( $current_object->ID ) )
    598598                {
    599599                        $wp_admin_bar->add_menu( array(
     
    604604                } elseif ( ! empty( $current_object->taxonomy )
    605605                        && ( $tax = get_taxonomy( $current_object->taxonomy ) )
    606606                        && current_user_can( $tax->cap->edit_terms )
    607                         && $tax->show_ui
    608607                        && $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) )
    609608                {
    610609                        $wp_admin_bar->add_menu( array(
  • src/wp-includes/link-template.php

     
    937937                $args['post_type'] = reset( $tax->object_type );
    938938        }
    939939
    940         $location = add_query_arg( $args, admin_url( 'edit-tags.php' ) );
     940        if ( $tax->show_ui ) {
     941                $location = add_query_arg( $args, admin_url( 'edit-tags.php' ) );
     942        } else {
     943                $location = '';
     944        }
    941945
    942946        /**
    943947         * Filter the edit link for a term.
     
    12541258        if ( !current_user_can( 'edit_post', $post->ID ) )
    12551259                return;
    12561260
    1257         $allowed = array_merge( array(
    1258                 'revision',
    1259         ), get_post_types( array(
    1260                 'show_ui' => true,
    1261         ) ) );
    1262 
    1263         if ( ! in_array( $post->post_type, $allowed ) ) {
    1264                 return;
     1261        if ( $post_type_object->_edit_link ) {
     1262                $link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
     1263        } else {
     1264                $link = '';
    12651265        }
    12661266
    12671267        /**
     
    12741274         * @param string $context The link context. If set to 'display' then ampersands
    12751275         *                        are encoded.
    12761276         */
    1277         return apply_filters( 'get_edit_post_link', admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ), $post->ID, $context );
     1277        return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );
    12781278}
    12791279
    12801280/**
  • src/wp-includes/post-functions.php

     
    10121012         */
    10131013        $args = apply_filters( 'register_post_type_args', $args, $post_type );
    10141014
     1015        $has_edit_link = ! empty( $args['_edit_link'] );
     1016
    10151017        // Args prefixed with an underscore are reserved for internal use.
    10161018        $defaults = array(
    10171019                'labels'               => array(),
     
    10821084        if ( null === $args->map_meta_cap )
    10831085                $args->map_meta_cap = false;
    10841086
     1087        // If there's no specified edit link and no UI, remove the edit link.
     1088        if ( ! $args->show_ui && ! $has_edit_link ) {
     1089                $args->_edit_link = '';
     1090        }
     1091
    10851092        $args->cap = get_post_type_capabilities( $args );
    10861093        unset( $args->capabilities );
    10871094