Fix menu_page_url() for submenu pages attached to custom menu pages. props duck_, see #14159.

git-svn-id: https://develop.svn.wordpress.org/trunk@16829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-12-09 04:02:37 +00:00
parent b8fdaa2dff
commit 684d85ff2f

View File

@ -1008,7 +1008,7 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
/** /**
* Add sub menu page to the tools main menu. * Add sub menu page to the tools main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1027,7 +1027,7 @@ function add_management_page( $page_title, $menu_title, $capability, $menu_slug,
/** /**
* Add sub menu page to the options main menu. * Add sub menu page to the options main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1046,7 +1046,7 @@ function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f
/** /**
* Add sub menu page to the themes main menu. * Add sub menu page to the themes main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1065,7 +1065,7 @@ function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/** /**
* Add sub menu page to the plugins main menu. * Add sub menu page to the plugins main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1084,7 +1084,7 @@ function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f
/** /**
* Add sub menu page to the Users/Profile main menu. * Add sub menu page to the Users/Profile main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1106,7 +1106,7 @@ function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun
} }
/** /**
* Add sub menu page to the Dashboard main menu. * Add sub menu page to the Dashboard main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1125,7 +1125,7 @@ function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug,
/** /**
* Add sub menu page to the posts main menu. * Add sub menu page to the posts main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1144,7 +1144,7 @@ function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/** /**
* Add sub menu page to the media main menu. * Add sub menu page to the media main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1163,7 +1163,7 @@ function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/** /**
* Add sub menu page to the links main menu. * Add sub menu page to the links main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1182,7 +1182,7 @@ function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/** /**
* Add sub menu page to the pages main menu. * Add sub menu page to the pages main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1201,7 +1201,7 @@ function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/** /**
* Add sub menu page to the comments main menu. * Add sub menu page to the comments main menu.
* *
* This function takes a capability which will be used to determine whether * This function takes a capability which will be used to determine whether
* or not a page is included in the menu. * or not a page is included in the menu.
* *
@ -1280,10 +1280,11 @@ function menu_page_url($menu_slug, $echo = true) {
global $_parent_pages; global $_parent_pages;
if ( isset( $_parent_pages[$menu_slug] ) ) { if ( isset( $_parent_pages[$menu_slug] ) ) {
if ( $_parent_pages[$menu_slug] ) { $parent_slug = $_parent_pages[$menu_slug];
$url = admin_url( add_query_arg( 'page', $menu_slug, $_parent_pages[$menu_slug] ) ); if ( $parent_slug && ! isset( $_parent_pages[$parent_slug] ) ) {
$url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) );
} else { } else {
$url = admin_url('admin.php?page=' . $menu_slug); $url = admin_url( 'admin.php?page=' . $menu_slug );
} }
} else { } else {
$url = ''; $url = '';
@ -1694,4 +1695,4 @@ function settings_fields($option_group) {
wp_nonce_field("$option_group-options"); wp_nonce_field("$option_group-options");
} }
?> ?>