-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
I'm following the instructions to develop a theme for Full Site Editing at
https://developer.wordpress.org/block-editor/tutorials/block-based-themes/
and received the following message "Template Part Not Found" on my Windows server.
I discovered that validate_file()
returns 2 for a fully qualified file e.g.
C:/apache/htdocs/wp56/wp-content/themes/fizzie/block-template-parts/header.html
.
gutenberg_render_block_core_template_part() doesn't cater for this value.
So the function fails to load the template part.
To reproduce
Steps to reproduce the behavior:
- On a Windows server
- Follow instructions to develop a theme for Full Site Editing
- View some content. e.g. Visit site.
- See the
Template Part Not Found
as part of the output.
Expected behavior
Code should be able to load template part files in a Windows server environment.
I suggest either change the logic to support a return value of 2 from validate_file().
or don't call validate_file() and validate the value for the slug
attribute.
If applicable, add screenshots to help explain your problem.
Editor version (please complete the following information):
- WordPress version: [e.g: 5.3.2] 5.5.1
- Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? [e.g: "gutenberg plugin", "default"] Gutenberg 5.5.1 with Full Site Editing selected.
- If the Gutenberg plugin is installed, which version is it? [e.g., 7.6]
Desktop (please complete the following information):
- OS: [e.g. iOS] Windows
- Browser [e.g. chrome, safari] Chrome
- Version [e.g. 22]
Additional context
I've implemented a local fix
$valid = validate_file( $template_part_file_path );
if ( ( 0 === $valid || 2 == $valid ) && file_exists( $template_part_file_path ) ) {
$content = file_get_contents( $template_part_file_path );
}