WordPress.org

Make WordPress Core

Ticket #7214: top-level-menu.diff

File top-level-menu.diff, 1.5 KB (added by DD32, 6 years ago)
  • wp-admin/admin.php

     
    4545 
    4646// Handle plugin admin pages. 
    4747if (isset($plugin_page)) { 
    48         $page_hook = get_plugin_page_hook($plugin_page, $pagenow); 
     48        if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) 
     49                $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); 
    4950 
    5051        if ( $page_hook ) { 
    5152                do_action('load-' . $page_hook); 
  • wp-admin/includes/plugin.php

     
    271271 
    272272        $admin_page_hooks[$file] = sanitize_title( $menu_title ); 
    273273 
    274         $hookname = get_plugin_page_hookname( $file, '' ); 
     274        $hookname = get_plugin_page_hookname( $file, $file ); 
    275275        if (!empty ( $function ) && !empty ( $hookname )) 
    276276                add_action( $hookname, $function ); 
    277277 
     
    299299        // as the first item in the submenu.  If the submenu file is the same as the 
    300300        // parent file someone is trying to link back to the parent manually.  In 
    301301        // this case, don't automatically add a link back to avoid duplication. 
    302         if (!isset( $submenu[$parent] ) && $file != $parent  ) { 
     302        if (!isset( $submenu[$parent] ) && $file != $parent ) { 
    303303                foreach ( $menu as $parent_menu ) { 
    304304                        if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) ) 
    305305                                $submenu[$parent][] = $parent_menu;