Ticket #27253: 27253.diff
| File 27253.diff, 4.4 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/menu.php
122 122 $edit_tags_file = "edit-tags.php?taxonomy=%s&post_type=$ptype"; 123 123 } 124 124 125 $drafts_file = "edit.php?post_type=$ptype&post_status=draft"; 126 125 127 if ( in_array( $ptype, $builtin ) ) { 126 128 $ptype_menu_id = 'menu-' . $ptype_for_id . 's'; 127 129 } else { … … 139 141 $submenu[ $ptype_file ][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file ); 140 142 $submenu[ $ptype_file ][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, $post_new_file ); 141 143 144 if ( $ptype_obj->show_drafts_in_menu ) { 145 $submenu[ $ptype_file ][12] = array( $ptype_obj->labels->drafts, $ptype_obj->cap->edit_posts, $drafts_file ); 146 } 147 142 148 $i = 15; 143 149 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 144 150 if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) ) -
src/wp-includes/class-wp-post-type.php
138 138 public $show_in_menu = null; 139 139 140 140 /** 141 * Whether to display a link to 'Drafts' in the post type submenu. 142 * 143 * To work, `$show_in_menu` must be true. 144 * 145 * @since 4.7.0 146 * @access public 147 * @var bool 148 */ 149 public $show_drafts_in_menu = false; 150 151 /** 141 152 * Makes this post type available for selection in navigation menus. 142 153 * 143 154 * Default is the value $public. … … 387 398 'publicly_queryable' => null, 388 399 'show_ui' => null, 389 400 'show_in_menu' => null, 401 'show_drafts_in_menu' => false, 390 402 'show_in_nav_menus' => null, 391 403 'show_in_admin_bar' => null, 392 404 'menu_position' => null, … … 425 437 $args['show_in_menu'] = $args['show_ui']; 426 438 } 427 439 440 // If not 'show_in_menu', don't show drafts either. 441 if ( ! $args['show_in_menu'] ) { 442 $args['show_drafts_in_menu'] = false; 443 } 444 428 445 // If not set, default to the whether the full UI is shown. 429 446 if ( null === $args['show_in_admin_bar'] ) { 430 447 $args['show_in_admin_bar'] = (bool) $args['show_in_menu']; -
src/wp-includes/post.php
23 23 'name_admin_bar' => _x( 'Post', 'add new on admin bar' ), 24 24 ), 25 25 'public' => true, 26 'show_drafts_in_menu' => true, 26 27 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 27 28 '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 28 29 'capability_type' => 'post', … … 941 942 * level menu (eg. 'tools.php' or 'edit.php?post_type=page'), the post 942 943 * type will be placed as a sub-menu of that. 943 944 * Default is value of $show_ui. 945 * @type bool $show_drafts_in_menu Whether to show a link to drafts in the post type submenu. To work, 946 * `$show_in_menu` must be true. Default false. 944 947 * @type bool $show_in_nav_menus Makes this post type available for selection in navigation menus. 945 948 * Default is value $public. 946 949 * @type bool $show_in_admin_bar Makes this post type available via the admin bar. Default is value … … 1267 1270 * @since 4.4.0 Added the `insert_into_item`, `uploaded_to_this_item`, `filter_items_list`, 1268 1271 * `items_list_navigation`, and `items_list` labels. 1269 1272 * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object. 1273 * @since 4.7.0 Added the `drafts` label. 1270 1274 * 1271 1275 * @access private 1272 1276 * … … 1297 1301 'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ), 1298 1302 'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ), 1299 1303 'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ), 1304 'drafts' => array( _x( 'Drafts', 'post drafts' ), _x( 'Drafts', 'page drafts' ) ), 1300 1305 ); 1301 1306 $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; 1302 1307