[wp-trac] [WordPress Trac] #54515: Block template themes: Parent theme block template takes precedence over child theme PHP template
WordPress Trac
noreply at wordpress.org
Thu Nov 25 19:58:36 UTC 2021
#54515: Block template themes: Parent theme block template takes precedence over
child theme PHP template
-----------------------------+-----------------------------
Reporter: Bernhard Reiter | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
When a theme has a PHP template of a certain specificity (e.g. `page-
home.php`), and it happens to be a child theme of another theme which has
a block template for the same specificity (e.g. `page-home.html`),
WordPress will currently pick the parent theme’s block template over the
child theme's PHP template to render the page.
This is regression. If the PHP and block template have equal specificity,
the child theme's template should be used. This issue was fixed before in
https://github.com/WordPress/gutenberg/pull/31123. The relevant logic has
since been modified and eventually [https://github.com/WordPress
/wordpress-develop/pull/1796 backported to Core] , so the fix now needs to
happen in Core (plus GB's
[https://github.com/WordPress/gutenberg/tree/3633b1758be0840f017e9407463a231689c49e3d/lib/compat/wordpress-5.9
pre-WP-5.9 compat layer], but that's somewhat secondary).
We have a [https://github.com/WordPress/wordpress-
develop/blob/21a7515fdb28ee10aa2f831d6d5786a6518283c9/tests/phpunit/tests
/block-template.php#L86-L114 unit test for this] (but obviously had to
disable it). The unit test existed in Gutenberg before but didn’t fail
there due to a faulty test setup. In fact, the issue was only found while
[https://github.com/WordPress/wordpress-
develop/pull/1920#issuecomment-975929818 backporting] the unit test.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54515>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list