[wp-trac] [WordPress Trac] #24137: CPT as a submenu item does not get the correct classes when adding new

WordPress Trac noreply at wordpress.org
Tue Nov 19 17:23:47 UTC 2013


#24137: CPT as a submenu item does not get the correct classes when adding new
-----------------------------+------------------------------
 Reporter:  mordauk          |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Post Types       |     Version:  3.5.1
 Severity:  normal           |  Resolution:
 Keywords:  has-patch wcorl  |
-----------------------------+------------------------------

Comment (by mordauk):

 Replying to [comment:8 nacin]:
 > I tested this at the WC Orlando contributor day and the patch wasn't
 needed. The steps to reproduce could benefit from some code. :-)
 >
 > {{{
 > #!php
 > <?php
 > add_action( 'admin_menu', function() {
 >       add_menu_page( 'Top Level', 'Top Level', 'manage_options', 'top-
 level', function() { echo 'Top level.'; } );
 > });
 >
 > add_action( 'init', function() {
 >       register_post_type( 'book', array(
 >               'show_ui' => true,
 >               'show_in_menu' => 'top-level',
 >       ) );
 > } );
 > }}}
 >
 > get_admin_page_parent() properly updates the parent to allow this to
 work. The code I was showed used 'show_ui' => false, which hides the menu
 (technically leaving the page still accessible, which is either a bug or
 an easter egg), and then add_submenu_page(). I don't think we should
 account for that with this patch here, especially since show_in_menu has
 existed since 3.1 (show_ui was 3.0).

 That's actually a different issue.

 Here are the steps to replicate this issue:
 - Register a top-level post type
 - Register a second post type that is set to a submenu of the post type
 registered in 1
 - Go to the child post type
 - Click "Add New" for the child post type
 - The parent post type All items submenu will be highlighted instead of
 the submenu item of the child post type

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


More information about the wp-trac mailing list