diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php index bb04f7767c171..61ac9833d4ff9 100644 --- a/src/wp-includes/block-template-utils.php +++ b/src/wp-includes/block-template-utils.php @@ -417,7 +417,7 @@ function _get_block_templates_files( $template_type, $query = array() ) { $template_slug = substr( $template_file, // Starting position of slug. - strpos( $template_file, $template_base_path . DIRECTORY_SEPARATOR ) + 1 + strlen( $template_base_path ), + strrpos( $template_file, $template_base_path . DIRECTORY_SEPARATOR ) + 1 + strlen( $template_base_path ), // Subtract ending '.html'. -5 );