WordPress.org

Make WordPress Core

Ticket #24689: 24689.2.diff

File 24689.2.diff, 492 bytes (added by Shelob9, 4 years ago)

More useful message when admin page doesn't exist

  • wp-admin/includes/menu.php

    index 7480402..bec78bc 100644
    a b function sort_menu($a, $b) { 
    330330        unset( $menu[ $last_menu_key ] );
    331331unset( $last_menu_key );
    332332
     333global $_registered_pages;
     334if ( isset( $_GET[ 'page' ] ) && !isset($_registered_pages[get_plugin_page_hookname( $plugin_page, get_admin_page_parent() )]) ){
     335        wp_die( __( 'The page you have requested does not exist.' ), 403 );
     336}
     337
     338
    333339if ( !user_can_access_admin_page() ) {
    334340
    335341        /**