[wp-trac] [WordPress Trac] #22022: Can’t properly add pages of type edit.php?post_type=xxx as submenu items to arbitrary parent menus

WordPress Trac noreply at wordpress.org
Sat Jan 5 06:55:13 UTC 2013


#22022: Can’t properly add pages of type edit.php?post_type=xxx as submenu items to
arbitrary parent menus
--------------------------+------------------------------
 Reporter:  jjharr        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  3.4.2
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by jjharr):

 * cc: jjharr (added)


Comment:

 Providing a simpler explanation and a patch in hopes that something
 happens with this issue :

 Simpler explanation : in menu-header.php, the 'parent_file' filter runs
 before the get_admin_page_parent() function, but the
 get_admin_page_parent() function can change $parent_file, overriding the
 filter and rendering in ineffective. So the filter needs to run after that
 function.

 Patch : All this does is swap the filter and function lines. The only way
 this would break existing code is if someone was relying on the internal
 behavior of get_admin_page_parent() to override the value they set in
 their filter function - which is not very likely.
 =====================

 --- wp-admin/menu-header.php
 +++ wp-admin/menu-header.php
 @@ -19,10 +19,11 @@ $self = preg_replace('|^.*/plugins/|i', '', $self);
  $self = preg_replace('|^.*/mu-plugins/|i', '', $self);

  global $menu, $submenu, $parent_file; //For when admin-header is included
 from within a function.
 -$parent_file = apply_filters("parent_file", $parent_file); // For plugins
 to move submenu tabs around.

  get_admin_page_parent();

 +$parent_file = apply_filters("parent_file", $parent_file); // For plugins
 to move submenu tabs around.
 +
  /**
   * Display menu.
   *
 =====================

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


More information about the wp-trac mailing list