From 39669ab911a9ac069ee53ce328713357c6dfb4bb Mon Sep 17 00:00:00 2001 From: Sagar Tamang Date: Mon, 25 Nov 2024 22:30:19 +0545 Subject: [PATCH] Added a link to the template parts page in wp_die() when the template part does not exist. --- src/wp-admin/site-editor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index 6588df79426ac..75e97827ad567 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -87,7 +87,14 @@ $block_template = get_block_template( $_GET['postId'], 'wp_template_part' ); if ( null === $block_template ) { - wp_die( __( 'Invalid template part ID.' ) ); + wp_die( + __( 'Invalid template part ID.' ), + '', + array( + 'link_url' => add_query_arg( array( 'postType' => 'wp_template_part' ), admin_url( 'site-editor.php' ) ), + 'link_text' => __( 'Return to template parts page' ), + ) + ); } break; }