From 1df4f2a0df66335469b576c61d3c0b056b3b32fe Mon Sep 17 00:00:00 2001 From: Himanshu Pathak Date: Tue, 26 May 2026 19:18:00 +0530 Subject: [PATCH] Administration: Add a 'Go to Dashboard' link to the access-denied wp_die screen --- src/wp-admin/includes/menu.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/menu.php b/src/wp-admin/includes/menu.php index a95cf9e33956e..3384858b68ff3 100644 --- a/src/wp-admin/includes/menu.php +++ b/src/wp-admin/includes/menu.php @@ -381,7 +381,15 @@ function sort_menu( $a, $b ) { */ do_action( 'admin_page_access_denied' ); - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); + wp_die( + __( 'Sorry, you are not allowed to access this page.' ), + __( 'You need a higher level of permission.' ), + array( + 'response' => 403, + 'link_url' => admin_url(), + 'link_text' => __( 'Go to Dashboard' ), + ) + ); } $menu = add_menu_classes( $menu );