[wp-trac] [WordPress Trac] #56762: PHP file being ignore in block theme hierarchy
WordPress Trac
noreply at wordpress.org
Fri Oct 7 21:00:27 UTC 2022
#56762: PHP file being ignore in block theme hierarchy
---------------------------+-----------------------------
Reporter: ryanpluckrose | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 6.0.2
Severity: major | Keywords: needs-patch
Focuses: template |
---------------------------+-----------------------------
Hi
I've tried the following in WP 6.0 and 6.1 as well as the TwentyTwentyTwo
and TwentyTwentyThree themes.
Issue:
When using the "Default Template" option on a Page, the page.php file is
ignored but page.html will work. You will see in admin that it is set to
Index as it is ignoring the page.php file but if you have both .html and
.php the .html will take precedence.
Admin + File structure:
https://monosnap.com/file/0IwMr0nBwtXDkd8SEIb0QjUGTn7Qsb
It looks like the problem comes from the code below in this file `wp-
includes/block-template-utils.php` line 313
{{{
$template_slug = substr(
$template_file,
// Starting position of slug.
strpos( $template_file, $template_base_path . DIRECTORY_SEPARATOR ) +
1 + strlen( $template_base_path ),
// Subtract ending '.html'.
-5
);
}}}
I'm not certain but I also found this in the Gutenberg side and wondering
if it didn't make it across (unless I'm mistaken).
https://github.com/WordPress/gutenberg/pull/31478/files
It's been driving me mad!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56762>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list