WordPress.org

Make WordPress Core

Ticket #16714: 16714.4.diff

File 16714.4.diff, 1.9 KB (added by scribu, 6 years ago)
  • wp-admin/menu.php

    diff --git wp-admin/menu.php wp-admin/menu.php
    index 26e8eab..d57136d 100644
    $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 
    4949$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'none' );
    5050        $submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
    5151        /* translators: add new post */
    52         $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );
     52        $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'create_posts', 'post-new.php' );
    5353
    5454        $i = 15;
    5555        foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
  • wp-includes/capabilities.php

    diff --git wp-includes/capabilities.php wp-includes/capabilities.php
    index 8252723..e194cb7 100644
    function map_meta_cap( $cap, $user_id ) { 
    10461046                                $caps[] = $post_type->cap->delete_private_posts;
    10471047                }
    10481048                break;
     1049        // current_user_can( 'create_posts', $post_type )
     1050        case 'create_posts':
     1051                $post_type = isset( $args[0] ) ? $args[0] : 'post';
     1052                $post_type_object = get_post_type_object( $post_type );
     1053
     1054                $caps[] = $post_type_object->cap->create_posts;
     1055
     1056                break;
    10491057                // edit_post breaks down to edit_posts, edit_published_posts, or
    10501058                // edit_others_posts
    10511059        case 'edit_post':
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index ddf78ab..376132e 100644
    function get_post_type_capabilities( $args ) { 
    12961296                'edit_others_posts'  => 'edit_others_'  . $plural_base,
    12971297                'publish_posts'      => 'publish_'      . $plural_base,
    12981298                'read_private_posts' => 'read_private_' . $plural_base,
     1299                // Post creation capability simply maps to edit_posts by default:
     1300                'create_posts'       => 'edit_'         . $plural_base,
    12991301        );
    13001302
    13011303        // Primitive capabilities used within map_meta_cap():