From 3d6fa2c247b9b7d128ac83975470c9505be542df Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 2 Nov 2023 15:03:04 +0530 Subject: [PATCH 1/4] Update template.php --- src/wp-includes/template.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php index 989d630f7fce4..3d71254681d08 100644 --- a/src/wp-includes/template.php +++ b/src/wp-includes/template.php @@ -61,10 +61,12 @@ function get_query_template( $type, $templates = array() ) { */ $templates = apply_filters( "{$type}_template_hierarchy", $templates ); - $template = locate_template( $templates ); - - $template = locate_block_template( $template, $type, $templates ); + $block_template = locate_block_template( '', $type, $templates ); + if ( $block_template ) { + return $block_template; + } + $template = locate_template( $templates ); /** * Filters the path of the queried template by type. * From 811a373eea8f7d584c61b1675946589fad3d411a Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 2 Nov 2023 15:10:08 +0530 Subject: [PATCH 2/4] Update block-template.php --- src/wp-includes/block-template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 7030e2e2a19f5..67abf030b55a0 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -28,7 +28,7 @@ function _add_template_loader_filters() { * @global string $_wp_current_template_content * @global string $_wp_current_template_id * - * @param string $template Path to the template. See locate_template(). + * @param string $template Path to the template. * @param string $type Sanitized filename without extension. * @param string[] $templates A list of template candidates, in descending order of priority. * @return string The path to the Site Editor template canvas file, or the fallback PHP template. @@ -37,7 +37,7 @@ function locate_block_template( $template, $type, array $templates ) { global $_wp_current_template_content, $_wp_current_template_id; if ( ! current_theme_supports( 'block-templates' ) ) { - return $template; + return ''; } if ( $template ) { From 24477eccdd6cc5b691fcfca1dadf39391f619e76 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 2 Nov 2023 16:46:31 +0530 Subject: [PATCH 3/4] Update block-template.php --- src/wp-includes/block-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 67abf030b55a0..390d67bb44766 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -83,7 +83,7 @@ function locate_block_template( $template, $type, array $templates ) { } } else { if ( $template ) { - return $template; + return ''; } if ( 'index' === $type ) { From 57a59bec9e992a3674b8dbaaddf2ec59aae52e26 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 2 Nov 2023 16:55:10 +0530 Subject: [PATCH 4/4] Update block-template.php --- src/wp-includes/block-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 390d67bb44766..67abf030b55a0 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -83,7 +83,7 @@ function locate_block_template( $template, $type, array $templates ) { } } else { if ( $template ) { - return ''; + return $template; } if ( 'index' === $type ) {