[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:06:58 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 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).

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


More information about the wp-trac mailing list