[wp-trac] [WordPress Trac] #31805: network menu page url

WordPress Trac noreply at wordpress.org
Mon Mar 30 11:20:28 UTC 2015


#31805: network menu page url
--------------------------+----------------------------------------
 Reporter:  dll1024       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  4.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration, multisite
--------------------------+----------------------------------------

Comment (by needle):

 I agree - there's definitely a case for updating that function. In the
 meantime, you can roll your own or use the following which works for me:


 {{{
 function network_menu_page_url($menu_slug, $echo = true) {
         global $_parent_pages;

         if ( isset( $_parent_pages[$menu_slug] ) ) {
                 $parent_slug = $_parent_pages[$menu_slug];
                 if ( $parent_slug && ! isset( $_parent_pages[$parent_slug]
 ) ) {
                         $url = network_admin_url( add_query_arg( 'page',
 $menu_slug, $parent_slug ) );
                 } else {
                         $url = network_admin_url( 'admin.php?page=' .
 $menu_slug );
                 }
         } else {
                 $url = '';
         }

         $url = esc_url($url);

         if ( $echo ) echo $url;

         // --<
         return $url;

 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31805#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list