[wp-trac] [WordPress Trac] #12453: Custom Post Types break admin menu (was: _wp_menu_output() needs to use add_query_arg())

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 3 15:12:33 UTC 2010


#12453: Custom Post Types break admin menu
--------------------------+-------------------------------------------------
 Reporter:  TobiasBg      |       Owner:             
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  3.0        
Component:  Post Types    |     Version:             
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------

Comment(by TobiasBg):

 I did some more digging:

 It looks like the problem is caused by the call of
 {{{get_admin_page_parent()}}} without an argument
 [http://core.trac.wordpress.org/browser/trunk/wp-
 admin/includes/plugin.php#L1343 here]. It will then return "edit.php"
 instead of "edit.php?post_type=page".
 Because of the empty argument, the function attempts to use $pagenow to
 find the $parent. For the "Pages" menu, that also is edit.php now, due to
 the Custom Post Types (it used to be edit-pages.php). This correlates to
 the parent of the "Posts" menu. Because of that, it is assumed that the
 menu entry belongs to the "Posts" menu, but it was registered for the
 "Pages" menu.

 Some other weirdness (that's not of functional but more optical relevance)
 comes from [http://core.trac.wordpress.org/browser/trunk/wp-
 admin/menu.php#L180 this line]. The basename() call on
 "edit.php?post_type=page" basically fails and just returns the input
 unmodified, so that sanitize_title cleans it to "edit-phppost_typepage".
 If basename would deliver "edit" as it does with the argument "edit.php",
 the problem would vanish, however the "Pages" menu would use an incorrect
 parent.

 I changed the title of this ticket, because there's a more severe issue
 than just the missing usage of {{{add_query_arg()}}}.

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


More information about the wp-trac mailing list