diff --git src/wp-admin/includes/menu.php src/wp-admin/includes/menu.php
index 7480402..7ea6c84 100644
|
|
|
if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) |
| 330 | 330 | unset( $menu[ $last_menu_key ] ); |
| 331 | 331 | unset( $last_menu_key ); |
| 332 | 332 | |
| 333 | | if ( !user_can_access_admin_page() ) { |
| | 333 | if ( ! admin_page_exists() ) { |
| | 334 | |
| | 335 | /** |
| | 336 | * Fires when access to an admin page does not exist. |
| | 337 | * |
| | 338 | * @since 4.6.0 |
| | 339 | */ |
| | 340 | do_action( 'admin_page_not_found' ); |
| | 341 | |
| | 342 | wp_die( __( 'The requested page does not exist.' ), 403 ); |
| | 343 | } elseif ( ! user_can_access_admin_page() ) { |
| 334 | 344 | |
| 335 | 345 | /** |
| 336 | 346 | * Fires when access to an admin page is denied. |
diff --git src/wp-admin/includes/plugin.php src/wp-admin/includes/plugin.php
index b6fe335..a501c62 100644
|
|
|
function get_plugin_page_hookname( $plugin_page, $parent_page ) { |
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | 1676 | /** |
| | 1677 | * @since 4.6.0 |
| | 1678 | * |
| | 1679 | * @global $admin_page_parent |
| | 1680 | * @global string $plugin_page |
| | 1681 | * @global array $_registered_pages |
| | 1682 | */ |
| | 1683 | function admin_page_exists() { |
| | 1684 | global $admin_page_parent, $plugin_page, $_registered_pages; |
| | 1685 | |
| | 1686 | if ( ! isset( $admin_page_parent ) ) { |
| | 1687 | $admin_page_parent = get_admin_page_parent(); |
| | 1688 | } |
| | 1689 | |
| | 1690 | if ( isset( $plugin_page ) ) { |
| | 1691 | $hookname = get_plugin_page_hookname( $plugin_page, $admin_page_parent ); |
| | 1692 | |
| | 1693 | if ( ! isset($_registered_pages[$hookname]) ) { |
| | 1694 | return false; |
| | 1695 | } |
| | 1696 | } |
| | 1697 | |
| | 1698 | return true; |
| | 1699 | } |
| | 1700 | |
| | 1701 | /** |
| 1677 | 1702 | * |
| 1678 | 1703 | * @global string $pagenow |
| 1679 | 1704 | * @global array $menu |
| … |
… |
function get_plugin_page_hookname( $plugin_page, $parent_page ) { |
| 1685 | 1710 | */ |
| 1686 | 1711 | function user_can_access_admin_page() { |
| 1687 | 1712 | global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv, |
| 1688 | | $plugin_page, $_registered_pages; |
| | 1713 | $plugin_page, $_registered_pages, $admin_page_parent; ; |
| 1689 | 1714 | |
| 1690 | | $parent = get_admin_page_parent(); |
| | 1715 | $parent = isset( $admin_page_parent ) ? $admin_page_parent : get_admin_page_parent(); |
| 1691 | 1716 | |
| 1692 | 1717 | if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) |
| 1693 | 1718 | return false; |
| … |
… |
function user_can_access_admin_page() { |
| 1698 | 1723 | |
| 1699 | 1724 | $hookname = get_plugin_page_hookname($plugin_page, $parent); |
| 1700 | 1725 | |
| 1701 | | if ( !isset($_registered_pages[$hookname]) ) |
| | 1726 | if ( !admin_page_exists() ) { |
| 1702 | 1727 | return false; |
| | 1728 | } |
| 1703 | 1729 | } |
| 1704 | 1730 | |
| 1705 | 1731 | if ( empty( $parent) ) { |