[wp-trac] [WordPress Trac] #14145: Allow custom post types to be a submenu

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 28 02:30:18 UTC 2010


#14145: Allow custom post types to be a submenu
-----------------------------+----------------------------------------------
 Reporter:  nacin            |       Owner:     
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  3.1
Component:  Post Types       |     Version:     
 Severity:  normal           |    Keywords:     
-----------------------------+----------------------------------------------

Comment(by nacin):

 Replying to [comment:3 t31os_]:
 > Andy i don't believe you're taking into consideration that post types
 usually have several subitems, and setting `show_in_menu` only registers
 the main/parent item for the post type (the link to
 `edit.php?post_type=MYPOSTTYPE`), missing other items such as "Add New",
 "Taxonomy 1", "Taxonomy 2" and so on... which would usually appear under a
 post type's given menu (as with any post type, posts for example). I
 personally think the function would serve little purpose if it doesn't
 register the other items along with the main link to `edit.php` ...

 I think it comes down to use case. If the plugin wants to register a post
 type as a submenu, then obviously taxonomies would not appear under (or
 rather, next to) it, and they would have to register taxonomy menus on
 their own. Or, we could make it optional as well to show taxonomies as
 sibling submenu items.

 > We can already effectively move items by way of hooking onto
 `admin_menu` and re-sorting or modifying the `$menu` array, etc..
 >
 > Could you please clarify what this new parameter aims to do?

 It aims to make it easy to have a post type submenu item start as a
 submenu item. Currently it's a bit ridiculous to do. You need show_ui to
 be true, but then you need to unset the corresponding key for $menu,
 either by looping through the array to find it, or by setting
 menu_position to some high, unique-enough number then unsetting exactly
 that key. #14666 will alleviate the removal pain, but regardless you still
 need to add the submenu item when you're done. It's dirty, and cheap.

 There are plenty of good use cases for having post types a submenu, and I
 think it should be much easier to do. I know jane is also +1 on this from
 a UI perspective because it will lead to less menu bloat. There are also
 good use cases for wanting the UI activated (show_ui), but for it not to
 appear in a menu at all. Hence fine-grained controls will be excellent.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14145#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list